Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Help Subclassing a Grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00174843
Message ID:
00174850
Views:
27
>Greetings!
>
>I have grids that are built programatically from scratch, based on criteria as the application is running. This works fine, except that I do not appear to have the ability to maintain any event code, such as WHEN or VALID, since event methods are read-only during runtime.
>
>I set up a grid from which to subclass, that has one column containing a text field with the necessary event code. When I set up a grid based on that class, only the first column inherits the parent's event code, and any columns added later do not get the code.
>
>It would appear that the programatically-created grid is only inheriting features of the parent, so long as the new grid is not wider than the parent.
>
>Instead of having a parent with "X" number of colunns pre-populated with redundant event code, is there a way to cause new text fields added in each column to be a subclass of a separate text field class, one containing all the event code needed, just once?
>
>Or... is there a better and more "right" way to do this??
>
>Thanks!
>
>Michael Reynolds


Try creating a textbox class (ex: MyGridTextBox) in the same classlib as your subclassed grid. Put the necessary generic code in this object. Then when building your grid columns out, AddObject( "newText", "myGridTextBox" ) to each column. Then, as necessary with either explicit column.currentcontrol = "newtext", or by using Grid.SetAll() method, make all current controls = the custom textbox added...

HTH.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform