popupMenu "on close" or something that can do the job?


#1

Hello there, script crunchers, is there a way to execute commands when the user clicks away from the popupMenu? Basically like “on popupMenu open do”, but the opposite :slight_smile:


#2

Unfotunately, it works in global scope only. If you wrap this code with the parentheses it stops working again

(	
	global rcmenu_was_cancelled = true
	
	rcmenu rc
	(
		menuItem item "item"
		
		on item picked do 
		(
			rcmenu_was_cancelled = false			
		)
	)

	PopupMenu rc

-- 	wtf ??? not working here
-- 	messageBox (if ::rcmenu_was_cancelled then "Cancelled" else "Picked")
)
-- but working there
messageBox (if ::rcmenu_was_cancelled then "Cancelled" else "Picked")