Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On Selection Bar problem
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00174974
Message ID:
00174976
Views:
19
>Hello All,
>
>*/I recently added the code below to an existing menu definition in a class method.
>
>DEFINE BAR 8 OF SHORTCUT PROMPT MyPrompt;
> KEY SHIFT+F3,"Shift+F3"
>
>*/This Crashes.
>ON SELECTION BAR 8 OF SHORTCUT this.ChangeCase()

The problem lies in the fact that this is referential to an object internal context, and the menu itself doesn't have such a reference in and of itself; there's no form or object association to guarentee the resolution of "this". If instead of "this", you referenced a routine in a .PRG as you noted, or used a globally resolvable object reference, you'd be OK. If a global object oApp existed with a method ChangeCase(), you could say:

ON SELECTION BAR 8 OF SHORTCUT oApp.ChangeCase()

If necessary, within the oApp.ChangeCase method, you could resolve the current form and control and redirect to a ChangeCase() method of the active object if one existed that way.

>
>This.ChangeCase is a method in this class., the error message I receive is This cannot be used outside a method, any ideas
>
>TIA
>Pete Kane.
>
>p.s. If I put the code from changecase in a prg and call it, no problem.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform