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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup menu and form method

Status
Not open for further replies.

nevin2007

Programmer
Aug 21, 2009
31
IR
hi all
I try to active a context menu by right clicking on a textbox.
when user click a bar of menu a method of parent form must run.the parent form name is test. i write this code in right click event of text box.all things ok when the form window type is modal but i want form be modalless and vfp show this error message " object test is not found" when menu selected. i use vfp9 sp2

can anyone help me please ?
Code:
Define Bar 1 Of cShortcut Prompt [ delete ]
On Selection Bar 1 Of cShortcut test.deleteit()
Activate Popup cShortcut
 
This happens because, at the time that the user clicks the menu, the object reference "test" is not available.

You need to do something like this:

Code:
LOCAL loForm 
loForm = THISFORM
DEFINE BAR .... etc. etc.

.....
ON SELECTION BAR 1 OF cShortcut loForm.DeleteIt()

I think that should do what you want.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
hi mike
i found the solution for this problem and share it here.
i use _scree.activeform instant of test .
another thing i found is that i can use _screen.forms(i) to scan all active form and found the aim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top