Notifier On Close Custom Dialog

How to make a notifier for dialog closing with [X] top-right button? I have a midi_callback function, and don’t know how to close midi device after my tool closed with [X] button. The tool is only one custom dialog. Thank you.

1 Like

i am extremely interested in finding out if this is possible. please, anyone, do tell, if you know how to do it.

1 Like

I’ve never put a notifier on a close?

Instead, I just create a sort of startup and teardown routine.

Out of context example

  
function idler(notification)  
 if (not VB or not MY_INTERFACE or not MY_INTERFACE.visible) then  
 stop()  
 return  
 end  
 -- Do idler stuff  
end  
  
  
function run()  
 -- Do some crap in here, example:  
 if not (renoise.tool().app_idle_observable:has_notifier(idler)) then  
 renoise.tool().app_idle_observable:add_notifier(idler)  
 end  
 if not (renoise.song().tracks_observable:has_notifier(function_name)) then  
 renoise.song().tracks_observable:add_notifier(function_name)  
 end   
 -- More stuff to start   
end  
  
  
function stop()  
 -- Do some crap in here, example:  
 if (renoise.tool().app_idle_observable:has_notifier(idler)) then  
 renoise.tool().app_idle_observable:remove_notifier(idler)  
 end   
 if (renoise.song().tracks_observable:has_notifier(function_name)) then  
 renoise.song().tracks_observable:remove_notifier(function_name)  
 end  
 -- More stuff to stop  
end  
  
  
function start()  
 build_interface()  
 run()  
 -- More suff, probably  
end()  
  

In the above, everytime I start the app, I first build an interface then setup all my notifiers in run(). Then, when the interface disapears (VB, MY_INTERFACE, declared in global space) I teardown all the junk I want gone in stop().

You can see this in action in Grid Pie Lite

Hope this helps.

Thanx a lot. It’s working. And btw - did you know is possible to make a button with wrapped text on it?