Mid-Michigan Computer Consultants - Bay City, Michigan

CONTENTS       (old style)
Mid-Michigan Computer Consultants
509 Center
Bay City, Michigan

Sales (989) 892-9242
Support (989) 686-8860

Plb-0264.cfm v1.0


ANSI Standard PL/B Language and Visual PL/B


This web resource is written for our own use. But we feel strongly that the PL/B language should be shared with the software community. So feel free to use this at will! BUT PLEASE... if you find errors or omissions or have a better way to do something. TELL US! Dialog helps us all. Send e-mail to:


This section discusses RIGHT CLICKING and using FLOAT MENUS.

This section has not been completed. These are preliminary notes.

RIGHT CLICK on the mouse has become a common and expected Windows behavior. Other than the button used, the click or double click event fires as usual.

The button used can be found in the event MODIFIER value. The best documentation of this is in the EVENTINFO section of the PL/B manual which lists all of the values.

You can get this value a couple of ways:
  1. Within a PLFORM event you can get access to several event values which are available as "#" local variables. If you want to communicate those to your mainline program, move them to open variables from within the PLFORM routine. The MMCC "COMMONWK" include unit contains parallel variables to mirrow the "#" variables found in the PLFORM. Our standard event code from within the PLFORM looks like this:
            MOVE    "LV2-CLICK",ACTION
            MOVE    #EventType,   EventType
            MOVE    #EventResult, EventResult
            MOVE    #EventObjId,  EventObjId
            MOVE    #EventChar,   EventChar
            MOVE    #EventMod,    EventMod
  2. You can also get the value with the EVENTINFO instruction. This can be done back in the mainline program after the event has been processed in the PLFORM routine.
            EVENTINFO   0,MODIFIER={num variable}


    The FLOAT MENU is a standard PLB object and is easy to create. You can include all the special characters and other things that are found in most menus.
    (See MENU notes.)
    (See FREDDY program FR903010 for example code.)

    Float menus are interesting because they popup when activated then go away on the next event of any type.

    Float menus must be created by hand rather than within the PLFORM. That's not difficult. Just define the object, CREATE it, then ACTIVATE it when needed.
    FLOAT_MENU_OBJ FLOATMENU                                      ;definition
                   CREATE   FLOAT_MENU_OBJ=top:bottom:left:right:
                               "&Delete;&Insert;&Rename"          ;menu items
                   ACTIVATE FLOAT_MENU_OBJ:                       ;menu object
                            FLOAT_MENU_ACTION:                    ;processing routine
                            MENU_RESULT                           ;numeric variable
              . . . . . . . . . . .
                   IF (MENU_RESULT = 1)
                       ... code for item 1 (Delete)
                   ELSEIF (MENU_RESULT = 2)
                       ... code for item 2 (Insert)
                   ELSEIF (MENU_RESULT = 3)
                       ... code for item 3 (Rename)
    You can CREATE a float menu once in a program and then just ACTIVATE it every time you need it. OR you can CREATE it every time it's needed. Both methods seem to work as well.

    In the example above the float menu is created on the MAIN WINDOW. It's position will be relative to the main window. When ACTIVATED, however, it will always be shown on top of all active windows. You can also create the menu on the current PLFORM window. In that case, the menu will be positioned relative to the PLFORM window.
          CREATE   FLOAT_MENU_OBJ=top:bottom:left:right:    ;create on MAIN window
                      "&Delete;&Insert;&Rename"             ;menu items
       . . . . . . . . . 
          CREATE   PLF_WINDOW;FLOAT_MENU_OBJ=top:bottom:left:right:    ;create on FORM window
                      "&Delete;&Insert;&Rename"             ;menu items


    Active FLOATMENUs normally accept ONLY the left mouse button. You can tell the system to accept either left or right by setting the RIGHTBUTTON property for the menu:

    The following is Sunbelt's sample program called TFLOATM.PLS from the demo directory.
    . Date:  04 Apr 1995
    . Purpose: This sample program demonstrates the use of a FLOAT menu object.
    .          This program uses a MREGION to cover part of the WINDOW.  When
    .          the user clicks with the left mouse button in the MREGION, then
    .          coordinates of the MREGION is determined and a FLOAT menu is
    .          activated at those coordinates.  When the right mouse button is
    .          used, then a different FLOAT menu is presented.
    A        FLOATMENU
    A2       FLOATMENU
    B        MREGION
    R        FORM      9
    D        FORM      4
    Z        FORM      1
    H        FORM      4
             SETMODE   *PIXEL=ON
    . Create FLOAT menu which uses the left mouse button
             CREATE    A=2:2:2:25,"a;Menu Item 1;Compiler;Menu Item 3"
    . Create FLOAT menu can use the RIGHT mouse button
             CREATE    A2=2:2:2:25,"a;Alt Item 1;Alt Item 2;Alt Item 3":
    . Create a MREGION ( mouse region ) to cover part of the window used.
             CREATE    B=0:250:0:300
             ACTIVATE  B,X,R
    . This is the main program loop
    . This action routine processed events for the MREGION object.  The routine
    . determines wheither the left or right button is used as well as the
    . Vertical and Horizontal coordinates where the mouse was clicked in the
    . mouse region.  Once this information is determined then the appropriate
    . FLOAT menu is activated at the coordinates where the mouse was clicked.
    . Note: The new SETPROP statement was used to change the TOP and LEFT
    .       coordinates of the FLOAT menu objects.
             MOVE      R TO D            ;Get the TOP coordinate
             CALC      H=R/10000         ;Calculate the LEFT coordinate
             CALC      Z=R/100000000     ;Calculate the 9th digit of the result
    . Show the TOP and LEFT coordinates
             DISPLAY   *P1:20,"V=",D,"  H=",H
    . Use the set property (SETPROP) statement to change the TOP/LEFT coordinates
    . of the FLOAT menu objects.
             SETPROP   A,TOP=D,LEFT=H
             SETPROP   A2,TOP=D,LEFT=H
    . When the value of Z is 0 or 2, then the left mouse button was used.
    . Otherwise, the right mouse button was used.
             IF      ( Z = 0 | Z = 2 )
              DISPLAY  *P1:21,*EL,"A  X:",R;
              ACTIVATE A,X1,R                 ;Show FLOAT menu for LEFT mouse
              DISPLAY  *P1:21,*EL,"A2 X:",R;
              ACTIVATE A2,X1,R                ;Show FLOAT menu for RIGTH mouse
    . This is the action routine for either FLOAT menu object.  This routine
    . simply shows the result value passed to the action routine.
             DISPLAY   *P1:22,"ITEM:",R


Write to MMCC Technical Support at:               Send e-mail to MMCC.
MMCC - Technical Support
600 W. Midland
Bay City, MI 48708
(989) 686-8860
© 1997 - 2022 MMCC - All Rights Reserved