Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Giving code to a grid column at runtime.
Message
From
05/08/1999 08:30:34
 
 
To
05/08/1999 07:18:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00250099
Message ID:
00250114
Views:
17
>Hi!
>
>I want to set the
>grid.columnX.header1.click()
>
>code at runtime How can I do this?
>
>I tried....
>
>&ctheControl="thisform.browselist.column"+alltrim(str(i))+'.header1.WriteMethod("click","thisform.sortcolumn")'
>&ctheControl
>
>All I really need is for this click event to have the code...
>thisform.sortcolumn
>

Since you really can't add code directly at runtime, the best approach would be to create a subclass of the Column and header classses that contain the necessary Click() method code, and then programatically add instances of the Column subclass to the grid or a subclass of the grid.

You'll need to programmatically define subclasses of the Column and Header class; they can't be subclassed visually (IOW, you'll have to write a .PRG file that contains the subclasses, using the DEFINE CLASS command, rather than using the Class Browser or Class Designer to maintain them in a .VCX file. You'll need to make the class definitions availale using SET PROCEDURE rather than SET CLASSLIB.)

You may want to look at some of the sample Grid classes in the Files Section here on UT to see if someone has already built something that provides the functionality you need, or at least gives you a running start on the process of creating the necessary non-visual classes.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform