I’m a little puzzled as to how I might add a disclosure triangle button to my window that when toggled will hide or show a certain section of information. Like the Finder’s Inspector window, for example.
Is this even possible in AppleScript Studio? If so, could anyone describe how it’d be constructed or point me toward any examples where this is demonstrated?
I assume I’d add an “on clicked” handler for the button, but then how is that section of information loaded into the window and the container window dynamically resized?
Name your disclosure button “disclosure” and attach the “clicked” handler in IB. Then, your script, add something like:
on clicked the_object
set object_name to name of the_object as string
if object_name = "disclosure" then
if state of the_object = 0 then
set the_delta to 200
else
set the_delta to -200
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
Is there a way to do that, but by moving the bottom edge up to cover things up. As it is, the thing i want to hide/show is at the bottom, and it stays visible, but some of the top gets hidden. Thanks for any help you can give me.
The code I posted above does exactly what you want. You just need to change the settings for autosizing of the elements in the window via the size pane of the info palette in Interface Builder. For an example, see this demo project: