nokesja has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,
I posted this question on "comp.lang.perl.tk" and never got a reply. I've been writing a pretty complicated Perl/Tk application for a university research project. I'm testing it on both Wn2K AS and RedHat 6.2. I'm having a problem with sizing widgets and having them not share space with the taskbar on both systems. Basically, I'm wondering how I can maximize a Tk widget (irregardless of screen resolution) and have the bottom of the widget automatically rest on top of any existing taskbar, rather than have it disappear behind it. Is there a way (cross platform hopefully) to determine the height of any taskbar in pixels from the window manager or something? I'm thinking this would be easiest since I could then just subtract the height from the Tk widget at the bottom.

Thanks in advance,
- Jeff

Replies are listed 'Best First'.
Re: Sizing Tk Widgets WRT the Taskbar
by Jouke (Curate) on May 09, 2001 at 11:45 UTC
    I understand your question, but I must say that doing it this way (and thus not considering any panels or taskbars):
    # Create the main window my $main = MainWindow->new(); # Maximize the window my ($screenw, $screenh) = ($main->screenwidth, $main->screenheight); $main->geometry($screenw."x".$screenh);
    Works for me on both KDE, Gnome and Win98. It just maximizes the main window and does not go behind panels or taskbars.

    hth

    Jouke Visser, Perl 'Adept'
      Hmmm,
      Interesting... I'm doing the same thing and it doesn't work for me! Here's my code below:
      my $mw = MainWindow -> new (); $screen_h = $mw -> screenheight (); $screen_w = $mw -> screenwidth (); $mw -> geometry ($screen_w . "x" . $screen_h);
      Any suggestions?
      - Jeff
Re: Sizing Tk Widgets WRT the Taskbar
by the_slycer (Chaplain) on May 09, 2001 at 09:42 UTC
    Well, at first glance it appears as though the answer to your question is "no".

    I don't believe that Tk provides any information about a "panel" on any given OS/Window Manager/GUI. Actually just looking at that last sentence it's quite obvious why not. Plainly put, there are simply too many different options. From the Gnome Panel to the KDE panel, to WM's docking bar, or FVWM95's "start bar", even MS-Windows has different "shells" that don't use a Start bar.

    There are some other options though - perhaps using takefocus/always focus within Tk will help ( I believe these are valid methods in Tk for toplevel objects). Though this will put it simply on top of the menu, and whether that will work for all of them I don't know (does the MS-Windows start menu relinquish it's always on top to other always on top apps? Is this implemented properly in Win32 port of Tk?).

    Perhaps the other option is some dirty hacks to find out position and size of current "panels". The gnome panel stores it's size info in ~/.gnome/panel.d/panel, Win32 probably has some info in the registry as to location and size of Start menu, I'm sure that KDE has some info regarding it's panel as well. The problem comes down to where and whom is going to be using the app. Good luck, oh and BTW if you ever find out where exactly in the registry Start menu info stays, please let me know ;-)