Rollout: Relative positioning of GUI elements (align in one axis)


#1

I constantly have multiple scripts open when working in 3dsMax, and the GUI’s are taking up too much space (even though I have tree monitors ). So I’m currently trying downsize the GUI’s of some of my scripts.

I could optimize the size of the GUI’s by aligning some of the elements horizontally, but I haven’t found a way to align the elements in a single axis. If I use pos:(x,y) it’s really painfull whenever I need to update the scripts (because of the hardcoded positions):

-- With this method I can't add a button above/below the checkboxes without updating the positions manually
checkbox check1 "Checkbox 1" checked:false width:120 height:20 pos:[15,60]
checkbox check2 "Checkbox 1" checked:false width:120 height:20 pos:[140,60]

I’m looking for a way which lets me specify their relative positions once instead of having to update their positions whenever adding/removing elements contained together with the positioned elements.

Is there some better way (a more dynamical/flexible method) of doing this?


#2

Pretty much sure there must be more elegant solution to this


try (destroydialog X ) catch ()
rollout X ""
(
	local w = 0, r = 0, rh = 20, gaph = 4, gapv = 4
	
	fn new_row = (r += 1; (r - 1) * rh + gapv * (r - 1))
		
	fn offset ctrl x y = 
	(
		ctrl.pos + [ x + gaph, y ]
	)
	
	button b1 "one"    pos:[ 10, new_row() ] width:(w = 33)
	button b2 "two"    pos:(offset b1 w 0)   width:(w = 44)
	button b3 "three"  pos:(offset b2 w 0)   width:(w = 55)
	
	button b4 "four"   pos:[ 10, new_row() ] width:(w = 60)
	button b5 "five"   pos:(offset b4 w 0)   width:(w = 80)
	
	button b6 "six"    pos:[ 10, new_row() ] width:(w = 60)

)
createDialog X pos:[100,100]

#3

i’d like use offset instead of pos ,set across number to group muti controls in one line


#4

show some examples (pictures) of what you want to get and I will try to suggest the best way how to make it.