Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with click code in grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01172171
Message ID:
01172173
Views:
17
You can't force code in at RUN-TIME, but what you can do (and I built a grid framework that builds columns dynamically and includes custom column, header, textbox controls that you can supercede... Its at

http://pafox.org/pafoxwcapp/Downloads/DynamicGrids.zip


Basically what you need to do is code a DEFINE CLASS of a textbox control, and put generic code you want to execute in the click. Then, when the columns are built, have it delete the default textbox control and then add your custom one.

If you take a look at the Dynamic Grids download, I have full source code there too, and includes incremental search, header sorts, dynamic adding columns, and even custom controls too... The grids are data driven by a header/detail table set so you don't have to hard-code as much, and adding columns at run-time is just adding another record in the detail table.



>Hi,
>
>I'm trying to loop through all the controls in a grid and set the click
code for every text box in the grid init.
>
>Can anyone help me with the syntax to include the 2 lines of code below in the click method of each text box ?
>
>***************************************************************************
>LOCAL liColIndex
>FOR liColIndex=1 TO this.ColumnCount && loop through all grid columns
> WITH this.Columns(liColIndex)
> IF upper(.CurrentControl) == 'TEXT1' && replace only columns that have default textbox
>
>* set the Click method of this textbox control
>* .Click = ??? the next 2 lines of code
>* Thisform.Foundkey = evaluate(THISFORM.cTableKey)
>* ThisForm.Release
>
> ENDIF
> ENDWITH
>ENDFOR
>***************************************************************************
>
>TIA
>Chris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform