Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing DblClick event on the fly

Status
Not open for further replies.

JCoates

IS-IT--Management
Dec 13, 2001
19
US
Hello once again...

One more issue to work through. Chpicker helped me set up some macros for an application that work very well... however I would like to set up DblClick events for each of 20 captions on a form. Each will run the same procedure/function but will pass it the caption information.

I've already got a loop set up to build the captions, but can't seem to programatically assign DblClick events. Can someone help me with the context of assigning it from within a program?

Thanks,
Jim Coates
jcoates@westmusic.com
Director of IT
West Music Company
 
Jim

You could create a new form method and call the form method from the .DblClick() events.

You can pass the caption as a parameter to the form method and process accordingly.

Thus, in a .DblClick() event, put :-

THISFORM.mMyNewMethod(THIS.Caption)

HTH

Chris [pc2]
 
Chris,

I'm not sure I am following you...

Basically I've got this going on...

for i = 1 to 20
cLabel = "thisform.label" + alltrim(str(i))
cCombo = "thisform.label" + alltrim(str(i))

&cLabel..caption = etc.
&cCombo..rowsource = etc.

endfor

I want to setup the DblClick events within this loop, as the parameters I want to pass will have different names (based on the macros) for each caption or combo box.

Thanks,
Jim
 
It is not possible to change event or method code at runtime. The only thing you can do is create all of the different methods you want to use as FORM methods, then use IF/THEN or DO CASE to execute the appropriate method.

You can also use macro substitution to call a method. Something like this:
[tt]
cLabel="thisform.Label1"
cMethod="BlinkMe"
cDoit=cLabel+"."+cMethod
&cDoit
[/tt]
Ian
 
Jim

If you want to assign code to an event at run-time, see faq184-928.

I was suggesting that by adding a new form method, all the processing from all the .DblClick() events would take place in one method.

You would only need to maintain one method - if you needed to identify the control that was the source of the double click, you could pass a second parameter, ie :-

THISFORM.mMyNewMethod(THIS.Caption,THIS.Name)

If you post an example of the code you want to assign, someone will guide you as to the best approach. HTH

Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top