Forget me for being such a noob on ReAction matters. But how on earth do you know when the user aborts the popupmenu without selecting an item? Apparently the MenuHandlerFunc is not called and I don't know enough about boopsi matters to figure out how to know such things otherwise.
Fri, 2014-06-06 22:17
#1
How to know when an popupmenu is aborted?
Hi, I use popupmenu(item).class in KeymapSwitcher and here is piece of code to "control" items:
When no option is choosed I simple 'DisposeObject()', if an item is choosed it goes thru 'switch(item_ID)' code and ends (again to 'DisposeObject()').
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Ok, I must have confused another problem with the one I was having, as my code looks pretty much exactly like yours. For some reason, I must have believed, that the call to IDoMethod was asynchronous and thus was commited to the additional belief, that I needed a signal from the MenuHandlerFunc to get what I wanted. Although, if you actually need to know, if the user aborts, then I don't see any way to get that information. Which is perhaps.... strange...
Didn't try, but myabe if you set a variable to return 0xFF (or whatever you want) in case no itemID matches or something alike then you'll know it popupmenu was "aborted/cancelled" or "used".
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
You can check the result of the IDoMethod call, like described in the popupmenu autodocs.
It is returning NULL, if the user did not select anything (which means that the popupmenu was aborted). Oterhwise it will return the popupmenuitem object.
uint32 result = IDoMethodA(APTR obj, struct pmOpen *msg);
FUNCTION
This method is used to open a popup menu.
INPUTS)
obj - popupmenu object pointer
msg - pointer to fully initialized struct pmOpen
(see
RESULT
The popupmenuitem object selected by the user or NULL
for nothing selected.
Off course the MenuHandlerFunc is not called, if the selection was aborted. So it is all pretty straight forward.