PDA

View Full Version : Unfolding views.


netytan
2005.04.30, 05:43 PM
I'm not sure the correct terminology for this one, I did read about it somewhere but I was unable to find it again.

Anyway what I'm trying to do is something like what you see in the Get Info panel: basically I want to have a section that will unfold at the click of a button – or, after I have filled the text field with some data – but remain hidden away otherwise :).

If anyone could give me a push in the right direction I would really appreciate it.

Thanks a lot guys,

Mark.

BrianToth
2005.04.30, 07:16 PM
In my app's rename window (ImageReel), I created a Box to contain the content I want to have "fold out". Then, when the disclose button is in the closed state, I hide the box and resize the containing window height = window height - box height using the animated resize method.

It seems to work and was easier than I thought. I took a bit of tweaking getting the interface to align how I wanted it to in both close and open states. I'd like to make a useful reusable Interface Builder item for that in the future, but that's a bit beyond me at the moment.

Codemattic
2005.04.30, 11:52 PM
http://www.snoize.com/

check out the DisclosableView

http://www.snoize.com/Code/DisclosableView.tar.gz

seb2
2005.05.02, 03:18 AM
Brian's approach is pretty much what I'm also doing.

Under 10.4, also have a look at the new NSViewAnimation. You can see an example of this in action in Mail 2.0 when you customize the fields for an e-mail that are visible by default.

netytan
2005.05.07, 04:53 PM
Thanks very much guys I have it working as I wanted now; I went with Brian and Sebs suggestion to resize the window and show the view: I am also using the NSViewAnimation class in a test application :).

Thanks again,

Mark.

netytan
2005.05.08, 06:55 PM
While reading thought the docs for the NSWindow class I found a new method that simplifies this much more: setFrame:display:animate. The down side being that it only works with Tiger.

Mark.

OneSadCookie
2005.05.08, 08:24 PM
-setFrame:display:animate: has been around for ages. It certainly doesn't require Tiger. I'd guess it's available back to 10.0.0.

netytan
2005.05.09, 05:56 PM
Wow, I must have missed it when I looked though the docs on Panther and since the release notes said that the resize functionality of the NSWindow class had be enhanced I just assumed it was new :). Thanks for the Info Cookie.