Expanding size of a window with a disclosure triangle via binding?

I have my application that has a disclosure triangle, and also a text object, that are connected to a script, that when either are clicked on, the window increases its size vertically, or if open then it collapses. Works totally fine for me at this point.

just script for the triangle object:

on clicked the_object
	set object_name to name of the_object as string
	if object_name = "triangle" then
		if state of the_object = 0 then
			set the_delta to 470
		else
			set the_delta to -470
		end if
		tell window of the_object
			set {x1, y1, x2, y2} to bounds
			set bounds to {x1, (y1 + the_delta), x2, y2}
		end tell
	end if
end clicked

I am wondering if I can do this via bindings or some way in IB. So I don’t have to use a script to do this. Can the disclosure triangle simply ‘add’ or ‘subtract’ size from the window? I understand how to do some basic bindings, like making a checkbox be able to enable or disable other checkboxes or UI items depending on its state… but how would adding a number size work? I see that the window object has size property/bindings.
TIA, Chris

Hey all,

restarting this topic because I’m interested to know: is there any way to do some binding instead of using the script?
The script above just doesnt work for me, its very random… it resizes randomly, once too long, once to short, and I have to click the disclosure button like 3 times for it to even do something.

i tried changing the code and it’s the same.
I’d like the upper part of my window to keep the same size, and the objects to stay in place, so that the disclosure just unhides a table view at the bottom.

Can anyone help me do that by any chance?

Thanks

EDIT | Good to mention that my main window, the one I’m trying this on, is resizable… would that be a problem?

RE-EDIT | I’ve been messing around with my app and just figured out that it’s very simple: all about the resizing options of each object. Nice. I love ASS !! (no pun intended :p)