Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

window on aqua without a titlebar

6 views
Skip to first unread message

Mike Ignatoski

unread,
Dec 2, 2012, 10:48:51 PM12/2/12
to tc...@perl.org
Tcl/Tk,

I am trying to create a top-level window that does NOT have a titlebar.

I have the following code:

$img_hover{win} = $mw->new_toplevel();
$img_hover{win}->g_wm_title ( "Balloon Card Image" );
$img_hover{win}->g_wm_iconbitmap ( $CONSTANTS{APP_ICON} );
$img_hover{win}->g_wm_geometry("$PM_CONSTANTS{BALLOON_IMG_X}x$PM_CONSTANTS{BALLOON_IMG_Y}");

$img_hover{win}->g_wm_resizable(0, 0); # make window size fixed,
not resizable
$img_hover{win}->g_wm_overrideredirect ( 1 );

on Win32, it works fine
on aqua, the window always has a titlebar

In addition, I'm using the window as a tooltip/balloon hover window, so
when it's shown, I never want it to have the "focus". When I deiconfy
it on Win32, it works great, but on OS X (aqua), it shows the window and
also grabs the focus, so I have to click on the main app to return focus.

Any insight is appreciated.

Thanks,
Mike

ps, I believe I'm using Tcl 8.5.8

Kevin Walzer

unread,
Dec 2, 2012, 11:05:07 PM12/2/12
to tc...@perl.org
On 12/2/12 10:48 PM, Mike Ignatoski wrote:
> In addition, I'm using the window as a tooltip/balloon hover window, so
> when it's shown, I never want it to have the "focus". When I deiconfy
> it on Win32, it works great, but on OS X (aqua), it shows the window and
> also grabs the focus, so I have to click on the main app to return focus.

The Tcl/Tk code on Aqua to achieve the effect you want looks something
like this:

if {[string equal [tk windowingsystem] aqua]} {
::tk::unsupported::MacWindowStyle style $top help none
}

where $top is a toplevel window. That doesn't grab focus.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Mike Ignatoski

unread,
Dec 2, 2012, 11:28:27 PM12/2/12
to tc...@perl.org
Thanks a lot, Kevin! It worked great....once I figured out that I had to
put that code immediately after creating the toplevel window. If I
placed the code after doing anything else with toplevel, such as setting
it's geometry, it didn't work.

Thanks, again!
Mike

ps that was fast!

Kevin Walzer

unread,
Dec 3, 2012, 9:41:56 AM12/3/12
to tc...@perl.org
On 12/2/12 11:28 PM, Mike Ignatoski wrote:
> Thanks a lot, Kevin! It worked great....once I figured out that I had to
> put that code immediately after creating the toplevel window. If I
> placed the code after doing anything else with toplevel, such as setting
> it's geometry, it didn't work.

Glad it was helpful, and I'm also glad you figured out when to place the
code--that's a little tricky to get right under Aqua, especially under
the new Cocoa bindings to Tk.

--Kevin
0 new messages