Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to click button
Message
From
22/11/2005 11:22:17
 
 
To
22/11/2005 11:01:48
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Network:
Novell 4.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01071180
Message ID:
01071188
Views:
18
How to click a button lying on a form thru a short cut menu. On doing so, I face an error "THIS can only be used within a method."

The actual command is 'This.parent.cmdSales.Click'


A menu isn't a child of anything, and what's more, isn't an object, so THIS.Parent is never going to work in a menu procedure.

A menu hit is more like an ON KEY interrupt, you can only address things that are in scope. So you must obtain a reference to your form through some other mechanism. Many people use _screen.ActiveForm or similar, i.e. the command in your menu procedure would be

_screen.ActiveForm.cmdSales.Click()

I'm not saying this would work for you; I'm saying you need to find another way to address your form.

I hope this helps,
- Colin
Previous
Reply
Map
View

Click here to load this message in the networking platform