Can you make a drawer transparent??

I have an app I have been working that has a window with the option of being transparent. There is also a drawer that can be opened from this window and I can’t figure out how to make it transparent… Any help???

Thanks in advance.

no one knows… :?

nevermind, i figured out how to.


I’m sorry that nobody was able to help you out and I’m glad that you were able to find a solution. Would you please share that information with the rest of the class? This sounds like something very interesting.

Brad Bumgarner, CTA

Is your brother Tim? He showed me how to do it. You have to make a cocoa category on NSDrawer and then call that from the applescript.

Nope. Our only connection is that we share a common surname.

Brad Bumgarner, CTA

I see, well if you need any help or want a sample let me know.

matt_premier wrote:

Brad Bumgarner wrote:

I believe he already asked you if you’d give everyone access to whatever your solution was.


I think I did.

They mean code. Actual project files. Downloadable source.


So no code ?

I’m trying to make a drawer transparent but I cant figure it out right now !

Best regards

Create a new Objective-C file called “MyViewController.” Create both .h and .m files
Subclass it NSView. In IB, set the identity of the drawer’s view to “MyViewController.”



Add something like this if you want to change the values from AppleScript.



Thanks Craig,

This seems to compile but I’m not sure what to do with that code if I want my slider thingy to set the alpha value of the drawer.

How can this code by used ?

Thanks …

Here is an example.

That’s awesome, thank you :wink:

You’re welcome.

Craig you rock ! :cool:

I do have a question : why cant I do this in applescript ? it used to work for an older version of my application :

on will open theObject
		set transparency to (do shell script "defaults read com.myApp.Try transparency") --as number
		set (alpha value of window "main") to transparency
	on error mer number ner
		do shell script "defaults write com.myApp.Try transparence 1"
		set (alpha value of window "main") to 1
		set (contents of slider "transparence" of drawer "drawer" of window "main") to 1
	end try
end will open

on action theObject
	set transparency to (contents of slider "transparency" of window of theObject) as real
	set (alpha value of window "main") to transparency
	set (alpha value of window of theObject) to transparency
end action

(the slider was in the drawer content view itself)

Now it wont work with :

on action theObject 
	set transparency to (contents of slider "transparency" of box "trans" of window "prefs")
	set (alpha value of window "mainWindow") to transparency
	set (alpha value of drawer "drawer" of window "mainWindow") to transparency 
end action

I’m willing to “complicate” my life with Obj-C (by that I mean that I dont know if Im going to be able to implement your example in my ASS app), but can someone at least explain why ths doesnt work ? Found nothing about it in the documentation…


Sorry, can’t really help with AppleScript Studio. Never used it that much.

You can implement this in your AppleScript Studio project the same way as in my example.
No reason to hook it up to AppleScript at all. Just do everything from Objective-C.

Fair enough, was just asking cause I like to at least know why I cant do this or that.

See, I’m not familiar with Obj-C at all right now… I’m keeping my ASS app for now and I’ll get to Obj-C once I move on to another little app.

I guess I could stuff that into my proj indeed, but I wanted the slider to set the transparency of both the main window AND the drawer at the same time.

If I dont find out how to do that from the project you sent me, I’ll just toss in 2 different sliders, whatever.

Thanks again Craig, you’re always of great help.

To set the Main window at the same time, add this to the .h file below the NSView outlet.

Then add this to the .m file just below the one for the NSView.

Be sure to control-drag from the Controller object in IB (blue cube) to the Main window
and choose “mainWindow.”