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 4DEFINE BAR 1 OF Menucont PROMPT '
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()