Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual FoxPro
Expertise: Beginner
Mar 5, 2000

Create a Context Menu

Question:
I'm having a problem creating a context menu in a grid (by clicking on the right button of the mouse). I created this menu by programming a method that calls the right-click event of the grid. But I can't associate a method with a pad by using ON SELECTION BAR .

Here my code:

DEFINE POPUP Menucont FROM MROW( ), MCOL( )
SHORTCUT TITLE "Pistes du CD" COLOR SCHEME 4
DEFINE BAR 1 OF Menucont PROMPT '\ 

Answer:
You are using THISFORM in the ON SELECTION command. THISFORM is only valid when executed from within a method of a form. Once the popup is activated, you are no longer in the method of the form. Therefore, THISFORM cannot be evaluated.

The solution to your problem is to use the ActiveForm reference on the _SCREEN object. _SCREEN.ActiveForm is a reference to the currently active form and can be evaluated outside of method code (it is like a global THISFORM).

To fix your problem, change your ON SELECTION command to the following:

ON SELECTION BAR 1 OF Menucont ;  
_SCREEN.ActiveForm.Btnnew.CLICK()
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap