Is it possible to close a custom dialog on opening a new song?
--show
renoise.app():show_custom_dialog( WOOT )
--close??
renoise.tool().app_release_document_observable:add_notifier(CLOSE WOOT)
Is it possible to close a custom dialog on opening a new song?
--show
renoise.app():show_custom_dialog( WOOT )
--close??
renoise.tool().app_release_document_observable:add_notifier(CLOSE WOOT)
I would like to thank may parents, my manager and Bantai for enabling the creation of this tool…
This just needed a slight mod to stop an error firing, depending on circumstance.
local function closer(d)
if d and d.visible then
d:close()
end
end
cheers again, seems to work great.
Heres an alternative simplified version without the “context magic”, based on Bantai’s version. Maybe easier to understand and handle in this case:
local my_dialog = nil
-------------------------------------------------------------------------------
local function open_dialog()
-- only show one dialog at the same time
if (my_dialog and my_dialog.visible) then
my_dialog:show()
return
end
-- create a new dialog
local vb = renoise.ViewBuilder()
my_dialog = renoise.app():show_custom_dialog("My Dialog",
vb:row{
vb:text{
text = "Bla blah, bla blah. Meh."
}
})
end
-------------------------------------------------------------------------------
local function close_dialog()
-- close the dialog, if its open
if (my_dialog and my_dialog.visible) then
my_dialog:close()
end
my_dialog = nil
end
-------------------------------------------------------------------------------
-- auto close the open dialog when the song gets exchanged, released
renoise.tool().app_release_document_observable:add_notifier(close_dialog)
-------------------------------------------------------------------------------
renoise.tool():add_menu_entry{
name = "Main Menu:Tools:DialogCloser",
invoke = open_dialog
}
Is it possible to get the close button at the top left to make a function call? It would need to call close_dialog() where I have added some :remove_child()'s that are necessary to avoid this error
std::logic_error: 'ViewBuilder: trying to add a view which already was added, probably into a different parent view.'
stack traceback:
[C]: in function 'add_child'
./gui.lua:195: in function 'dialog_create'
./gui.lua:221: in function 'show_dialog'
main.lua:66: in function <64><br>
<br>```
<br>
<br>
unless there's some kind of other way to get rid of these children without removing them explicitly?<br>
<br>
Ok, quick hack here for anyone who needs to do the same<br>
<br>
```lua<br><br>
function show_dialog()<br>
if dialog and dialog.visible then<br>
dialog:show()<br>
return<br>
end<br>
<br>
if vb then<br>
remove_vb()<br>
end<br>
<br>
create_dialog()<br>
add_group()<br>
end<br>
<br>
function remove_vb()<br>
vb.views.group:remove_child(one)<br>
vb.views.group_one = nil<br>
vb.views.group:remove_child(two)<br>
vb.views.group_two = nil<br>
vb.views.group:remove_child(three)<br>
vb.views.group_three = nil<br>
vb = nil<br>
end<br>
<br>
function close_dialog()<br>
if dialog and dialog.visible then<br>
remove_vb()<br>
dialog:close()<br>
dialog = nil<br>
end<br>
end<br>
<br>```
</64>
Should be easily solved by !always! recreating the vb when recreating the dialog.
if dialog and dialog.visible then
dialog:show()
return
end
-- when reaching this, the dialog never was created before or was closed
Thanks
Is it possible to have a notifier on the event, if someone closes a (non-modal) dialog by clicking on the “x” or pressing the key “escape”?
I would like to change some buttons on the Launchpad if the user closes a dialog. Using the method above will not work well, because I would have to check on every next (unpredictible) event if the dialog was closed.
Buy them a Sony Playstation 3
Another question i Have, is it possible to determine the Position of a new opened dialog? It seems the dialog is centered by default. It would be nice to have two screens next to each other.
Was a long wish for me as well, that’s why embedded the note-matrix into the epic arpeggiator tool. It used to be a separate window but it always popped up in front of the main arpeggiator dialog. That is currently the trick to do it. (Pop it out of any side by unhiding several objects and remove it by toggling the visibility parameter again)
Great trick, thanks!
That makes the solution of the “notify on close-dialog” problem redundant.
Nevertheless both things would be usable though.
You can also try emulate “Tabs” using the Switch button object and then make up several designs on the same spot.
Simply just hide and unhide the objects depending on the state of the switch button.
This question pops up again.
I also can not check if the main window of the tool was closed or not, if the user clicks the “x” in the main window.
I have a pattern change notifier, and regardless if the main window called ‘maingui’ is closed or not, vb.views[‘maingui’].visible is always true. Is there a way?
I am doing some time consuming tasks on patternchange and they need not to be done if the main window of the tool is not opened.
I used a trick for ther IRC client to figure out if a window was still open and even checked whether a connection was made (and is still open):
--If status window is closed, drop connection
--yet if status window was not raised, then drop connection upon closing
--the chat dialog. (if not switch_channel status is up)
if (not irc_dialog or not irc_dialog.visible) and status_dialog_mode then
But i think “if (not dialog or not dialog.visible) then” should suffice.
Thanks a lot, that worked