Entry-field and combo-box

His there a way to call w$menu with the right click on the mouse!

  • Make your menu a pop-up menu ... use the W$MENU routine with the WMENU-NEW-POPUP
  • If i click on the right bottom of the mouse i have a window menu...
  • I have MOUSE-FLAGS 130
    If i click on the right bottom of the mouse on a combobox or entry-field i have a window menu..no exception are return to the program...
  • 03 Screen1-Ef-1, Entry-Field,
    COL 19.90, LINE 7.20, LINES 2.80 CELLS, SIZE 18.70 CELLS,
    3-D, ID IS 1, POP-UP MENU IS Screen1-Mn-1-Handle,
    VALUE Screen1-Ef-1-Value.

    this provides you a popup-menu associated tothe entry-field
  • IDENTIFICATION DIVISION.
    PROGRAM-ID. Program1.
    DATE-WRITTEN. Friday, March 10, 2017 11:40:56 AM.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    SPECIAL-NAMES.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
    DATA DIVISION.
    FILE SECTION.
    WORKING-STORAGE SECTION.
    *{Bench}acu-def
    COPY "acugui.def".
    COPY "acucobol.def".
    COPY "crtvars.def".
    COPY "showmsg.def".
    *{Bench}end

    *{Bench}copy-working
    77 Quit-Mode-Flag PIC S9(5) COMP-4 VALUE 0.
    77 Key-Status IS SPECIAL-NAMES CRT STATUS PIC 9(4) VALUE 0.
    88 Exit-Pushed VALUE 27.
    88 Message-Received VALUE 95.
    88 Event-Occurred VALUE 96.
    88 Screen-No-Input-Field VALUE 97.
    88 Screen-Time-Out VALUE 99.
    * property-defined variable

    * user-defined variable
    77 Screen1-Handle
    USAGE IS HANDLE OF WINDOW VALUE NULL.
    77 Screen1-Mn-1-Handle
    USAGE IS HANDLE OF MENU VALUE NULL.
    77 Screen1-Ef-1-Value PIC X(30).
    01 .
    03 Screen1-Cm-1-Container-Item.
    05 PIC X(5)
    VALUE IS "Item1".
    05 PIC X(5)
    VALUE IS "Item2".
    05 PIC X(5)
    VALUE IS "Item3".
    78 Screen1-Cm-1-Container-Num VALUE IS 3.
    03 Screen1-Cm-1-Container REDEFINES
    Screen1-Cm-1-Container-Item PIC X(5)
    OCCURS 3 TIMES
    INDEXED Screen1-Cm-1-Container-Idx.
    77 Screen1-Cm-1-Value PIC X(5).
    77 Screen1-Mn-2-Handle
    USAGE IS HANDLE OF MENU VALUE NULL.
    77 Screen1-Mn-3-Handle
    USAGE IS HANDLE OF MENU VALUE NULL.

    *{Bench}end
    LINKAGE SECTION.
    *{Bench}linkage
    *{Bench}end
    SCREEN SECTION.
    *{Bench}copy-screen
    01 Screen1.
    03 Screen1-Ef-1, Entry-Field,
    COL 19.90, LINE 7.20, LINES 2.80 CELLS, SIZE 18.70 CELLS,
    3-D, ID IS 1, POP-UP MENU IS Screen1-Mn-1-Handle,
    VALUE Screen1-Ef-1-Value.
    03 Screen1-Cm-1, Combo-Box,
    COL 21.00, LINE 13.60, LINES 7.90 CELLS,
    SIZE 18.80 CELLS,
    3-D, ID IS 2, MASS-UPDATE 0,
    POP-UP MENU IS Screen1-Mn-2-Handle, DROP-DOWN, UNSORTED,
    VALUE Screen1-Cm-1-Value.

    *{Bench}end

    *{Bench}linkpara
    PROCEDURE DIVISION.
    *{Bench}end
    *{Bench}declarative
    *{Bench}end

    Acu-Main-Logic.
    *{Bench}entry-befprg
    * Before-Program
    *{Bench}end
    PERFORM Acu-Initial-Routine
    * run main screen
    *{Bench}run-mainscr
    PERFORM Acu-Screen1-Routine
    *{Bench}end
    PERFORM Acu-Exit-Rtn
    .

    *{Bench}copy-procedure
    COPY "showmsg.cpy".

    Acu-Initial-Routine.
    * Before-Init
    * get system information
    ACCEPT System-Information FROM System-Info
    * get terminal information
    ACCEPT Terminal-Abilities FROM Terminal-Info
    * create pop-up menu
    PERFORM Acu-Init-Popup
    * After-Init
    .

    Acu-Init-Popup.
    PERFORM Acu-Screen1-Mn-1-Menu
    MOVE Menu-Handle TO Screen1-Mn-1-Handle
    PERFORM Acu-Screen1-Mn-2-Menu
    MOVE Menu-Handle TO Screen1-Mn-2-Handle
    PERFORM Acu-Screen1-Mn-3-Menu
    MOVE Menu-Handle TO Screen1-Mn-3-Handle
    .

    Acu-Exit-Rtn.
    * After-Program
    EXIT PROGRAM
    STOP RUN
    .

    Acu-Screen1-Routine.
    * Before-Routine
    PERFORM Acu-Screen1-Scrn
    PERFORM Acu-Screen1-Proc
    * After-Routine
    .

    Acu-Screen1-Scrn.
    PERFORM Acu-Screen1-Create-Win
    PERFORM Acu-Screen1-Init-Data
    .

    Acu-Screen1-Create-Win.
    * Before-Create
    * display screen
    DISPLAY Standard GRAPHICAL WINDOW
    LINES 23.80, SIZE 55.00, CELL HEIGHT 10,
    CELL WIDTH 10, AUTO-MINIMIZE, COLOR IS 65793,
    LABEL-OFFSET 0, LINK TO THREAD, MODELESS,
    POP-UP MENU IS Screen1-Mn-3-Handle, NO SCROLL,
    WITH SYSTEM MENU,
    TITLE "Screen", TITLE-BAR, NO WRAP,
    EVENT PROCEDURE Screen1-Event-Proc,
    HANDLE IS Screen1-Handle
    * toolbar
    DISPLAY Screen1 UPON Screen1-Handle
    * After-Create
    .

    Acu-Screen1-Init-Data.
    * Before-Initdata
    PERFORM Acu-Screen1-Cm-1-Content
    * After-Initdata
    .
    * Screen1
    Acu-Screen1-Proc.
    PERFORM UNTIL Exit-Pushed
    ACCEPT Screen1
    ON EXCEPTION PERFORM Acu-Screen1-Evaluate-Func
    END-ACCEPT
    END-PERFORM
    DESTROY Screen1-Handle
    INITIALIZE Key-Status
    .

    * Screen1-Cm-1
    Acu-Screen1-Cm-1-Content.
    MODIFY Screen1-Cm-1, MASS-UPDATE = 1, RESET-LIST = 1
    MODIFY Screen1-Cm-1, ITEM-TO-ADD = TABLE
    Screen1-Cm-1-Container
    MODIFY Screen1-Cm-1, MASS-UPDATE = 0
    MODIFY Screen1-Cm-1, VALUE Screen1-Cm-1-Value
    .

    * Screen1
    Acu-Screen1-Evaluate-Func.
    EVALUATE TRUE
    WHEN Exit-Pushed
    PERFORM Acu-Screen1-Exit
    WHEN Event-Occurred
    IF Event-Type = Cmd-Close
    PERFORM Acu-Screen1-Exit
    END-IF
    END-EVALUATE
    MOVE 1 TO Accept-Control
    .

    Acu-Screen1-Exit.
    SET Exit-Pushed TO TRUE
    .

    * Screen1-Mn-1
    Acu-Screen1-Mn-1-Menu.
    PERFORM Acu-Screen1-Mn-1
    THRU Acu-Screen1-Mn-1-Exit.

    Acu-Screen1-Mn-1.
    CALL "W$MENU" USING Wmenu-New-Popup GIVING Menu-Handle
    IF Menu-Handle = ZERO
    GO TO Acu-Screen1-Mn-1-Exit
    END-IF
    CALL "W$MENU" USING WMENU-ADD, Menu-Handle, 0, 0,
    "menu from entry field", 1000
    .

    Acu-Screen1-Mn-1-Exit.
    MOVE ZERO TO Return-Code.

    * Screen1-Mn-2
    Acu-Screen1-Mn-2-Menu.
    PERFORM Acu-Screen1-Mn-2
    THRU Acu-Screen1-Mn-2-Exit.

    Acu-Screen1-Mn-2.
    CALL "W$MENU" USING Wmenu-New-Popup GIVING Menu-Handle
    IF Menu-Handle = ZERO
    GO TO Acu-Screen1-Mn-2-Exit
    END-IF
    CALL "W$MENU" USING WMENU-ADD, Menu-Handle, 0, 0,
    "response from combo", 1001
    .

    Acu-Screen1-Mn-2-Exit.
    MOVE ZERO TO Return-Code.

    * Screen1-Mn-3
    Acu-Screen1-Mn-3-Menu.
    PERFORM Acu-Screen1-Mn-3
    THRU Acu-Screen1-Mn-3-Exit.

    Acu-Screen1-Mn-3.
    CALL "W$MENU" USING Wmenu-New-Popup GIVING Menu-Handle
    IF Menu-Handle = ZERO
    GO TO Acu-Screen1-Mn-3-Exit
    END-IF
    CALL "W$MENU" USING WMENU-ADD, Menu-Handle, 0, 0,
    "screen pop-up menu", 1002
    .

    Acu-Screen1-Mn-3-Exit.
    MOVE ZERO TO Return-Code.


    Acu-Screen1-Event-Extra.
    EVALUATE Event-Type
    WHEN Msg-Close
    PERFORM Acu-Screen1-Msg-Close
    END-EVALUATE
    .

    Acu-Screen1-Msg-Close.
    ACCEPT Quit-Mode-Flag FROM ENVIRONMENT "QUIT_MODE"
    IF Quit-Mode-Flag = ZERO
    PERFORM Acu-Screen1-Exit
    PERFORM Acu-Exit-Rtn
    END-IF
    .

    Screen1-Event-Proc.
    *
    PERFORM Acu-Screen1-Event-Extra
    .
    *** start event editor code ***

     

    *{Bench}end
    REPORT-COMPOSER SECTION.