>Hi
>
>I have a grid class that has rightbutton popup menu for add & delete but I need to add right click event code to each column in the grid every time I use it.
>
>Is there a way I can programatically add this code or somehow set it as the default so that when I change the number of columns the rightclick event for every column is set to my new command.
>
>Regards
>Geoff Scott
Geoff,
You can workaround it in a number of ways.
1) Place a transparent container in front of grid and put your mouse event codes in container (propagating to grid as necessary). This is Nick Nelioudov's click transparency approach. I think you could find info about it in foxpro advisor.
2) Use your own textbox class which is added and used as default during grid init (or in design mode - similar code as below).
3) Maybe the simpliest way for quick things :
-Select your grid
-Go to command window
-Open a code window - say 'modify command Dummy' (you'd never save this)
-Code your method code, select all and copy, delete code. Code :
aselobj(arrGrid)
for each oColumn in arrGrid[1].Columns
oColumn.Text1.WriteMethod('RightClick', _Cliptext)
endfor
Select all, rightclick and Execute selected. Close code window w/o saving (unless you make it parametric to use at a later time:) Last approach is the same as you're going to each column's texbox and writing code to rightclick. It's a builder tnat's never registered :)
Cetin