Highlighted
Absent Member.
Absent Member.
6163 views

[archive] Right mouse click in paged list-box

[Migrated content. Thread originally posted on 09 May 2006]

How can I use the right mouse button in a paged list-box.
I don't get an event. I also tried "MOUSE-FLAGS" but this does not work.
There should be an easy answer to this (I hope).
I want to do this to have a popup-menu after I clicked the right mouse button.
0 Likes
19 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Have you defined the listbox similar to this:

Screen1-Lb-1, List-Box,
COL 33.90, LINE 10.50, LINES 15.00 CELLS,
SIZE 14.20 CELLS,
POP-UP MENU IS Screen1-Mn-1-Handle,

Procedure Division.

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, "first", 1000

MOVE Menu-Handle TO Screen1-Mn-1-Handle

display screen-w-list-box
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Yes thanks,

I didn't put "POP-UP MENU IS Screen1-Mn-1-Handle"
in my list-box.
I thought I had to create the menu after I clicked the right mouse button, but with this it works.

Thanks,
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

As a secondary issue with right mouse click on list box - does anyone know hoe to ascertain upon which line in the list box the mouse is pointing to? I would like to make sure that the line pointed to when the right click is made can be selected before the menu box comes up.

Keith
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Does anybody know an answer to Keith's question?
The line needs to be selected first before the menu appears.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

You'll need to put an event procedure on the list box and then use inquire to get theline in the list box:

inquire Form1-Lb-1 selection-index my-var
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

I can't seem to get it to work.
Could you send me a sample program?

thx
Andre
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Attaching sample. After getting the selection I did not do anything to the event, such as stop the menu from showing.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Thanks for the sample, but I still want the line selected before the menu appears. So when I'm at line 1 and I press the right-mouse button at line 3 I want line 3 to be selected first and then see the menu.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

When the focus goes to the list box you'll see that "Item 1" has focus but the color has not changed, use the arrow keys to select an item in the list box, right click, you;ll see that the event code is processed and then the menu appears.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

I made a change to the program to show hopw the event can be used. If you right click on the first item in the list the menu will not appear. The menu will appear for Item2 and Item3
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Right mouse click in paged list-box

Thanks for your effort but it still doesn't work for me.
I want the same thing that Keith asked.
The line in the list-box must be selected first after I clicked the right-mouse button and after that the menu must appear.
The problem is that the "selection-index" does not change in the event procedure after the right-mouse click
I think it cannot be done.

Thanks anyway
Andre
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.