realbasic-nug
[Top] [All Lists]

Re: Interface and background under OS X

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Interface and background under OS X
From: James Sentman <james at sentman dot com>
Date: Tue, 30 Jul 2002 16:54:05 -0400


 The current version of Mac OS X does not support controls over a
 complex background such as a picture.  Future versions of OS X
 probably will, and we will then be able to build that capability into
 RB.
Hurry up Apple !

I'm confused by this. It certainly is possible to draw controls over any background you like. When you call to draw a theme button or control, one of the settings you send is a callback to a function that fills in the background, whatever it may be or whatever you want to draw.

You dont have to pass anything at all, in which case no clearing is done on the rect before the control is drawn.

If you want to have things show through the controls, then you can't do that, but OSX happily draws the shadows over anything you have underneath it without erasing the background. I did a quick little demo with a single call to

DrawThemeButton(btnRect, proc, newInfo, oldInfo, 0, 0, 0)

online at:

http://www.sentman.com/picts/button_over_picture.jpg

The picture is in the backdrop of a canvas underneath the canvas onto which I'm drawing the button via the above command.

I dont see why RB has to always call the methods to clear the underlying graphics to the window background? There could certainly be options here.

Now, drawing these controls yourself has some very big aggrivations, so it's not that easy to overtake RB's plumbing and do this. First, you can't pass it a graphics object, it just draws into the current graphics object, or the window and it seems hard to get it to always end up where you want it. You'll have to monitor for mouse clicks and re-draw as necessary to display the correct state of the control. And it only seems to work properly when drawing from the pain event. Any other attempted drawing to the graphics object results in nothing at all. At least that is the result of my 15 minutes of messing around here. I'm sure that most if not all of those things could be overcome and made into a canvas based control that behaved very much like a regular RB control, but didn't erase the background...

Anybody have any more experience with drawing the theme controls like that?

Thanks,
 James
--
_____________________________________________________________________________
James Sentman <james at sentman dot com>                      
http://www.sentman.com
 Enterprise server monitoring for Mac OS X:  http://whistleblower.sentman.com


<Prev in Thread] Current Thread [Next in Thread>