Hi all,
I guess i did things wrong (i am NOT sure, but i am a bit confused on the matter). Others are saying drawers must be attached to “NSWindow & NSDrawer” cocoa-windows, but others are saying you can attach them to NSWindows on your own in IB.
I created an app in AS using NSWindow, not thinking i would want a drawer off the side of the window.
Later I was told by a UI Guy that what i was using a sheet for should’ve really (according to the UI Docs) have been in a drawer in my application. So, I went into IB and dropped a DRAWER icon into my MainMenu.nib. Then a VIEW icon into the main menu.nib.
Then I set Attributes on Drawer to RIGHT Preferred, connections to ContentView: NSVIEW, parentWindow: NSPanel (panelname)<which is interesting cos i used the NSWindow to create this window, not NSPanel.> and a button on MainWindow to which i attached the following script on the clicked handler a la:
on clicked theObject
if the name of theObject is equal to "opendrawer" then -- the button on nspanel
log "OpenDrawer clicked!"
set currentState to state of drawer "Drawer" of window "MainWindow" --drawer named "Drawer"
if currentState is equal to drawer closed or currentState is equal to drawer closing then
log "Drawer Closed"
tell window "MainWindow"
tell drawer "drawer"
open drawer
end tell
end tell
else
log "Drawer opening"
end if
end if
end clicked
I used the long versin of tell window…tell drawer to be specific. BUT, there is no error, it does NOTHING. except log “DRAWER CLOSED” to the log. Doesn’t open the drawer, does not log errors …nothing else.
NOW, here is the funny part: In IB if I click ctrl-click on the button, dragging the line to the DRAWER in the mainmenu.nib file, i can assign a TOGGLE connection. When i do this, and run it INSIDE OF IB, the button causes the drawer to open and close again (toggle) from the right side of “MainWindow”. The issue is that EVEN when i do this, i save that IB project and go back to applescript studio and it does not cause the Clicked event (nothing is in the log as even being clicked) nor does it open/close the drawer. (i even tried debugging the “on action theObject” handler… it does not show there either) I would be happy with just toggling the drawer, but obviously there is something strange i am doing wrong.
I have gone over every setting and this is killing me! I really want to get this finished this weekend.
PLZ HELP!
ps: for Xcode 2.2.1 BTW: 10.4.5 on 20" Intel iMac in case there is a question with that.
Thanks in advance…
Model: 20" intel iMac
AppleScript: ?
Browser: Safari 417.8
Operating System: Mac OS X (10.4)