Sliding Drawers and Windows

I am playing around with windows and ASOC, and Chapter 11 of Shane Stanley’s most excellent book. I have a drawer working (it slides open and it slides closed). The button that opens the drawer is in the primary view of the main window, and the button that closes the drawer is in the drawer’s view (which you don’t see until the drawer slides open). Very cool.

However I have two issues that I’d like to resolve, and if anyone has an answer I would greatly appreciate it.

  1. First, the width of the drawer. When the drawer slides out, it only slides out a certain distance. (I’m guessing 145 pixels.) When I created the drawer in Interface Builder (IB) I made it much wider. Say 300 pixels. I assumed that that is what controls the initial width, but “No.” (In fact, I find it interesting that the size of the drawer in IB appears to have no bearing whatsoever on anything, (You could make it the size of a postage stamp) but that is another story.)

Once I press the “Open” button on the main window, the drawer slides open (about 145 pixels)), I can then “pull” it open farther, using the control along the edge of the window. But there is the first issue. Where do I control how far the drawer initially slides open when I press the “Open” button? (Instead of having to “pull” it open.)

  1. Now the second issue. Currently I am using two basic buttons (The “Open” Button, and the “Close” Button). The “Open Button” is in the main window, and the “Close Button” is in the drawer. HOWEVER, I would like to use one button only. Say, for example, a disclosure button. This button would always be in the main window, with no button in the drawer. I envision pressing the disclosure button, which turns downward, and the drawer slides open. I then envision pressing the disclosure button again, which turns upward, and the drawer slides closed.

I can currently do either, but not both. (In other words, since I have two actions (Slide Open, Slide Closed) I need two buttons.)

Any help is greatly appreciated.

First, the size. When you drag out a window with drawer, you get a custom view and a drawer object (the blue cube). You need to click on the blue cube and change its size to what you want, and change the custom view to that size too.

As for the toggling of the open/close, just connect a disclosure triangle to the toggle method of the drawer (if you right click on the drawer cube you will see a received action called “toggle”)

Ric

Ric:

Thanks very much. Both worked great! I really appreciate your help.