Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to assing method to a grid's column
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00526757
Message ID:
00526870
Views:
23
Hi!

Wooah! I see I can say a lot on this topic...

First of all, take a look to the FAQ#8019 about grid reconstruction. Probably you can change the query in the grid without getting reconstruction of grid.




Second, you can define the column class in the PRG and add it to the grid by grid's AddObject method.

DEFINE CLASS MyColumn AS Column
...
ENDDEFINE

Then set procedure to that PRG file and use AddObject method of grid to add that column:
Grid.AddObject("Column"+allt(str(Grid.ColumnCount+1)),"MyColumn")

So you will add columns dynamically to grid. Do not forget to clear default columns that appear after reconstruction.



Third, you can define a hoo class. It is not better than second approach, however, when you already have a compiled file that you cannot recompile, this becomes very useful.

DEFINE CLASS MyHook AS Custom
oGridColumn=evaluate(cGridColumnReference)
procedure oGridColumn.MouseMove
...
endproc
ENDDEFINE

Then in the app, after grid reconstruction, create hook for each column in a loop:

private cGridColumnReference
cGridColumnReference = "thisform.Grid.Column1"
thisform.AddObject('MyHook1',"MyHook")
cGridColumnReference = "thisform.Grid.Column2"
thisform.AddObject('MyHook2',"MyHook")


The 4-th method is to put a cover shape over the grid and get rid of any code in the grid column. Cover shape will show proper mouse cursor. Forward mouse events from shape to the grid using API functions - the sample is in the Fancy ToolTip control that you can download here.

HTH.

>Hi all,
>
>I am using a grid with an SQL request in my form' init method. The grid'RowSourceType property is set to SQL (4) and RowSource property is set to the SQL request in my Form init method. I also modify DynamicBackColor and DynamicForeColor in the init method. So grid appears like I want, except the mouse pointer that appears like an "I" when I move on my grid.
>
>The only way I found to keep the MousePointer as an arrow is to set th Thisform.MousePointer to 1 in the MouseMove method of my column. It is possible when the grid is designed at design time. How can I do that programmaticaly? I'd like to assign code to some of my grid's column.
>
>Thanks
>Thierry
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform