Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programming Events within a Grid
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00094583
Message ID:
00095128
Views:
30
Ashley,

You basically can't add code to an object at runtime. So what you need to do is create a textbox subclass that knows how to handle your rightclick. Then at runtime substitute that subclass for the textbox that is there.

In the same loop you use to alter the ControlSource, change the textbox object like this:

for each oCol in this.Columns
   oCol.AddObject( "text2", "MySmartClass" )
   * this next WITH is optional
   with oCol.Text2
      * copy any formatting kind of info if not default
      .FontName = oCol.Text1.FontName
   endwith
   oCol.RemoveObject( "Text1" ) && get rid of original
   oCol.ControlSource = ...
endfor


>I have a table with 216 fields, 210 of which I would like to display in cells partially (substr function). Next I would like to attach a rightclick event showing d=greater detail in an information window.
>Due to the number of fields involved, I used a for...next loop in the init event of the form to set the ControlSource of each column - and this worked.
>I would like to go on to set the rightclick event (and others) except I don't know how to do this.
>I am having trouble finding concrete examples of how to set events for an object using code. I guess I'm trying to get the most convenient mix of visual design and code and am having little joy using trial and error methodology!
>
>As a worst case scenario I could manually set all 210 columns manually using the form designer, but there has got to be a better way!
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform