Invoking a pop-up menu from within a class

5 posts / 0 new
Last post
trixie
trixie's picture
Offline
Last seen: 5 months 2 hours ago
Joined: 2011-02-03 13:58
Invoking a pop-up menu from within a class

I wonder if anyone could help me out with this, as I'm out of my wits now.

I have a class that features a selector button, upon the pressing of which I want to invoke a context menu. The selection of the button is verified in GM_HANDLEINPUT - this is the place where I need to invoke the pop-up menu.

I tried all sorts of solutions - chooser.gadget and select.gadget in hidden mode, popupmenu.class, and menuclass - none of which really works as I want them to. With the chooser and select, I don't seem to be able to invoke the hidden pop-up at all. The popupmenuclass does not react to IDoMethod(popup, PM_OPEN, window), although I pass it a valid window pointer (the one I obtain from my gadget's GadgetInfo). It goes without saying that my pop-ups are configured OK because they work fine when I put them in a program; it's just the class context that makes them do nothing.

The best solution I could come up with so far is to use the menuclass' context menu feature. This operates via GM_QUERY, where the context pop-up menu is invoked upon receiving and confirming a GMQ_CONTEXTMENU type of query. The problem is, it only works upon pressing the RIGHT mouse button over my selector gadget, whereas I would very much prefer the LEFT button to be the trigger.

Could the menuclass context menu be invoked in some other way, or possibly tricked to react to the left mouse button? I tried sending my class a fake GM_QUERY from within GM_HANDLEINPUT (right after testing the selector) but it just crashed.

Any tips welcome because I'm at a complete loss :-(

jabirulo
jabirulo's picture
Offline
Last seen: 1 hour 18 min ago
Joined: 2013-05-30 00:53
Re: Invoking a pop-up menu from within a class

Hi, not sure if it helps, but I use popupmenuitem.class in KeyMapSwitcher docky tool (os4depot).
Attached is part of source code.

File attachments: 

AttachmentSize
File kms_src.lha7.05 KB

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

trixie
trixie's picture
Offline
Last seen: 5 months 2 hours ago
Joined: 2011-02-03 13:58
Re: Invoking a pop-up menu from within a class

@jabirulo

Thanks Javier, but this unfortunately does not work for me, god knows why :-(

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

trixie
trixie's picture
Offline
Last seen: 5 months 2 hours ago
Joined: 2011-02-03 13:58
Re: Invoking a pop-up menu from within a class

double post

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

Rigo
Rigo's picture
Offline
Last seen: 1 year 10 months ago
Joined: 2011-01-24 21:55
Re: Invoking a pop-up menu from within a class

The problem you have encountered here is because your gadgets GM_HANDLEINPUT is run on the context of input.device. When trying to envoke the popup, input.device is put to sleep while it waits for input from the user, but that input is never processed due to the stalled input.device process.

In string.gadget, the popup is envoked by creating a new child process to bring up the popup, and the result passed back in the class data structure which is then handled on the next input event.

Simon

Log in or register to post comments