Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menus with timeout
I have created a menu that offers useful options related to clipboard-entries (lcase, UCASE, various replacements etc.) that auto-opens when clipboard content changes. This works great and only one thing is missing: often I do not need these features at all.

One way to deal with it would be to set up a dedicated hotkey for this menu and remove the trigger. But I would actually prefer being able to have a timeout for the menu so that if no selection is made within 5 secs, it will automatically be closed. Is it possible to do something like that with what we have already - or would this need enhancements in QM itself?
in code that calls the menu
create a new subfunction
and call it before showing menu
Copy      Help
mac "sub.MenuTimeOut"
mac("Menu1");; shows the menu. change to your menu name

#sub MenuTimeOut
int w=wait(0 WC win("" "#32768"));;waits for menu window created
5 -WC w;; waits up to 5 seconds for menu window to close
,clo w;; if still open close menu window
Super, that's great! And that style of doing it will even allow me to show different menus - depending on the content that I find. 
Thanks, thanks, thanks!  Smile Smile Smile

Forum Jump:

Users browsing this thread: 1 Guest(s)