The ZAZ Blog: When all you have is a chicken and a rocket launcher, make some really badass scrambled eggs.

Determining if a window should be highlighted
« Previous Entry | Home | Next Entry »

I've been working on a window designed to look similar to Safari. This means a window with a "Unified" toolbar and tabs that blend into said toolbar.

The issue I have been having though is when sheets are involved. If you bring up the "Report Bug" sheet in Safari, you will notice that the window stays "active" - it's still drawn like it's in the foreground. So I used the code I posted earlier to determine if the window had a sheet attached, and drew the tabs active in that case.

But wait, it's not that simple. What if the window has a sheet attached, but the sheet is not the foreground window? This was becoming complicated.

That is, until I found the IsWindowHilited() Carbon function. This function, very simply, gives you a boolean stating wether or not to draw your controls in the foreground or background. Enjoy

Function IsHighlighted(Extends w As Window) As Boolean
#if TargetMacOS
soft declare function IsWindowHilited lib "Carbon.framework" (window As WindowPtr) as boolean
return IsWindowHilited(w)
#else
return false
#endif
End Function

License: Creative Commons (details) | Digg | E-Mail Thom McGrath
View More Entries From The Same: Day | Month | Year

Comments
Comments are being accepted below.

Pings
This entry is accepting pings.

Leave a comment
We utilize unique methods to ensure your email address stays private while remaining useful.
Depending on the authentication scheme used, some or all of the personal data entered below will be ignored in favor of the data stored with your account.


Disclaimer: I am currently an employee of REAL Software. My comments and opinions are mine alone and do not represent those of my employer. My posts are not official REAL Software communications, and may contain information that is incorrect or misleading.