Does Horizontal Resize Work For You?

heh, next question :unsure: :
i’m somewhat confused about the way resize works (or works not).
i would have expected the following code to resize to the width of the middle text (t2):

  
renoise.tool():add_menu_entry {  
 name = "Main Menu:Tools:Resize test",  
 invoke = function() resize() end   
}  
  
function resize()  
  
 local vb = renoise.ViewBuilder()  
  
 local dialog_content = vb:column {  
 id = "dialog_content",  
  
 vb:button {  
 text = "Hide & resize",  
 notifier = function()  
 vb.views.t1.visible = not vb.views.t1.visible  
 vb.views.t3.visible = not vb.views.t3.visible  
 vb.views.dialog_content:resize()  
 end,  
 },  
 vb:horizontal_aligner {  
 id = "hide_me",  
 vb:text {  
 id = "t1",  
 text = "Text left ...",  
 },  
 vb:text {  
 id = "t2",  
 text = "... Text middle ...",  
 },  
 vb:text {  
 id = "t3",  
 text = "... Text right.",  
 },  
 },  
 }  
  
 renoise.app():show_custom_dialog(  
 "Resize test", dialog_content)  
end  

… but it doesn’t.

EDIT: i don’t know if anybody has mentioned it already but dialogs seem to resize to the top of the screen under osx, which can lead to the title bar etc. disappearing …

yeah, resize doesn’t seem to take invisibility into account, so you also have to set width and height to 1 as well. but you have to do that before switch turn visible to false, since you also can’t change the size of elements which aren’t visible ^^

well, at least that’s how far I got :)

No, visibility is taken into account as well, but a resize will only resize the view you’re calling it for, will not be propagated to all sub views automatically.

In your case this is what you want:

  
 local vb = renoise.ViewBuilder()  
  
 local dialog_content = vb:column {  
 id = "dialog_content",  
  
 vb:button {  
 text = "Hide & resize",  
 notifier = function()  
 vb.views.t1.visible = not vb.views.t1.visible  
 vb.views.t3.visible = not vb.views.t3.visible  
  
 vb.views.hide_me:resize()  
 vb.views.dialog_content:resize()  
 end,  
 },  
  
 vb:row {  
 id = "hide_me",  
 vb:text {  
 id = "t1",  
 text = "Text left ...",  
 },  
 vb:text {  
 id = "t2",  
 text = "... Text middle ...",  
 },  
 vb:text {  
 id = "t3",  
 text = "... Text right.",  
 },  
 },  
 }  
  
 renoise.app():show_custom_dialog(  
 "Resize test", dialog_content)  
  

First make the row smaller, then the main content…

Ah!!! thanks for clearing that up.

Hmm I cheered too soon, I just tried it again…

Example 1 works even though it shouldn’t (since I’m only resizing the main view). Note however that it does NOT work if I just toggle visibility, as is shown in example 2, which doesn’t work at all?

[details=“Click to view contents”] ```lua
t_gui_presets[preset_id].view = vb:column
{
id = preset.name … “__MainView”,
t_gui_data[preset.gui_data_id].gui,
vb:row
{
vb:checkbox
{
value = false,
tooltip = “Show command lines?”,
notifier = function(v)
if v then
– order matters here
tf_resulting_command_lines.visible = true
tf_command_lines.visible = true
tf_command_lines.width = 400
tf_command_lines.height = 48
tf_resulting_command_lines.width = 400
tf_resulting_command_lines.height = 48
else
tf_command_lines.width = 1
tf_command_lines.height = 1
tf_resulting_command_lines.width = 1
tf_resulting_command_lines.height = 1
tf_resulting_command_lines.visible = false
tf_command_lines.visible = false
end
vb.views[preset.name … “__MainView”]:resize()
end,
},
vb:column
{
tf_command_lines,
tf_resulting_command_lines,
}
}
}

  
  
[details="Click to view contents"] ```lua  
t_gui_presets[preset_id].view = vb:column  
{  
 id = preset.name .. "__MainView",  
 t_gui_data[preset.gui_data_id].gui,  
 vb:row  
 {  
 id = preset.name .. "__LowerRow",  
 vb:checkbox  
 {  
 value = false,  
 tooltip = "Show command lines?",  
 notifier = function(v)  
 if v then  
 -- order matters here  
 tf_resulting_command_lines.visible = true  
 tf_command_lines.visible = true  
 else  
 tf_resulting_command_lines.visible = false  
 tf_command_lines.visible = false  
 end  
 vb.views[preset.name .. "__Commandlines"]:resize()  
 vb.views[preset.name .. "__LowerRow"]:resize()  
 vb.views[preset.name .. "__MainView"]:resize()  
 end,  
 },  
 vb:column  
 {  
 id = preset.name .. "__Commandlines",  
 tf_command_lines,  
 tf_resulting_command_lines,  
 }  
 }  
}  
  
``` [/details]