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 :-(
Hi, not sure if it helps, but I use popupmenuitem.class in KeyMapSwitcher docky tool (os4depot).
Attached is part of source code.
File attachments:
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
@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
double post
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
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