SupportJPG
  Support Home   |   Search   |   Documentation
ArticleId = kb000184

HOWTO: Right Click Pop-Up Menu in Subfile

The information in this article applies to:

    • ASNA Visual RPG, Release 3.0 and higher
    • Windows

SUMMARY:

This article will discuss a way in which you can provide a user with a Right Click on a Subfile and have a Pop-Up Menu appear.

NOTE: Figure 1 below shows how a pop-up menu appears on the users screen when the user right clicks.

Figure 1

MORE INFORMATION:

NOTE:  These methods listed below are examples.  There might be other methods in which this feature can be incorporated into an AVR application that is not mentioned in this article.

Requirements: 

  • A working subfile
  • A menu created

Program details:

This example assumes a form has a subfile control named sbfCust and a two-element option button array named optMenu. These two option buttons determine which pop-menu will be displayed. It also assumes the AVR menu editor has been used to define three menus. One as the form's top-level menu and two pop-up menus.

NOTE: Figure 2 below shows how these three menus look in the menu editor.

Note the hierarchy the menu editor uses to show relationships amongst menus. In the example below, mnuMain is the form's top-level menu (the form's top level menu is always the first one displayed in the menu editor); puPopUpMenu1 and pupPopUpMenu2 are the two pop-up menus. Note how these two pop-up menus aren't included in mnuMain's hierarchy. puPopUpMenu1 and puPopUpMenu2 are both separate menus from mnuMain. 

Understanding how AVR uses menu hierarchy is the key to understanding and creating pop-up menus. Try using the menu editor's four arrow keys to change the hierarchy to see how it affects the menus displayed.

Figure 2

TIP:  You don't have to the menu Visible to have this functionality.

Here is the code that is needed for the right click event to be triggered:

Name   = 'Company ABC' // Write one subfile
Number = '123'         // record.

 rrn    = rrn + 1 
 Write SubFile1

BegSr  sbfCust  MouseDown
 DclSrParm Button TYPE( *INTEGER ) LEN( 2 ) 
 DclSrParm Shift  TYPE( *INTEGER ) LEN( 2 ) 
 DclSrParm X      TYPE( *INTEGER ) LEN( 4 ) 
 DclSrParm Y      TYPE( *INTEGER ) LEN( 4 ) 

    DclConst RIGHT_BUTTON Value( 2 )

    // Check for right mouse click
    If ( Button = RIGHT_BUTTON )
        // If zeroth optMenu button is clicked...
        If ( optMenu[ 0 ].value )
            *ThisForm.PopUpMenu( 'puPopUpMenu1' )
        Else
            *ThisForm.PopUpMenu( 'puPopUpMenu2' ) 
        EndIf
    EndIf 

EndSr

To help understand the menu structure at work here, trying temporarily displaying the mnuMain menu as a pop-up:

  *ThisForm.PopUpMenu( 'mnuMain' )

Keywords: right click, example, client, develop, IDE, pop-up, menu, subfile, "popup menu"

Last Modified Date: 2/22/2002 9:49:51 AM

Copyright © 2005, 2006 ASNA Inc.

  Support Home   |   Search   |   Documentation