Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding method code at runtime
Message
From
12/11/2001 04:18:58
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/11/2001 18:22:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00580199
Message ID:
00580367
Views:
14
>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) && Get ref. to selected grid in designer
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform