How to get toplevel reqwidth before map without update()? 
Author Message
 How to get toplevel reqwidth before map without update()?

Hi all --

As the subject says, I'm trying to find a way to get the requested
width and height of the toplevel window, _before_ it's mapped, without
having to call update().  I'm writing a routine that will resize a
window containing a given Text widget so that the text widget will
grab as much screen real estate as necessary (depending on how many
lines are in it, how long the lines are, etc.), and I need to find out
the width/height taken up by the _other_ widgets that may be in the
window, so I can leave room for them onscreen.  I can call update(),
but then the window is drawn twice: once initially, and again after
I've resized the Text widget.  I can iconify() the window, update it,
and deiconify it when I'm done, but that seems pretty ugly too.

Is there any way to tell the packer to propagate the requested
geometry without updating the window?

Any thoughts appreciated...

-Michael



Sun, 05 Dec 1999 03:00:00 GMT  
 How to get toplevel reqwidth before map without update()?

:
: Hi all --
:
: As the subject says, I'm trying to find a way to get the requested
: width and height of the toplevel window, _before_ it's mapped, without
: having to call update().  I'm writing a routine that will resize a
: window containing a given Text widget so that the text widget will
: grab as much screen real estate as necessary (depending on how many
: lines are in it, how long the lines are, etc.), and I need to find out
: the width/height taken up by the _other_ widgets that may be in the
: window, so I can leave room for them onscreen.  I can call update(),
: but then the window is drawn twice: once initially, and again after
: I've resized the Text widget.  I can iconify() the window, update it,
: and deiconify it when I'm done, but that seems pretty ugly too.
:
: Is there any way to tell the packer to propagate the requested
: geometry without updating the window?
:
: Any thoughts appreciated...
:
: -Michael

I ended up having to do something like this:

my ($mycanvas) = $top->Canvas();
$mycanvas->configure(
        -height => '300',
        -width  => '600',
        -scrollregion => [0,0,300,600]);

my ($MainFrame) = $mycanvas->Frame;

...

DoOneEvent(1);  #HAVE TO CALL THIS TWICE BEFORE GEOMETRY INFO IS AVAILABLE
DoOneEvent(1);  #IN SUB RESIZE_CANVAS!
&resize_canvas;
MainLoop;

sub resize_canvas
{
        my ($mw) = $MainFrame->width;
        my ($mh) = $MainFrame->height;

        $mycanvas->configure(
                -height => $mh,
                -width  => $mw,
                -scrollregion => [0,0,$mw,$mh);

Quote:
}

Good Luck!

Jim Turner



Mon, 06 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TopLevel window without control menu

2. How to display a window without titlebar (toplevel)

3. Help..I am BIT without a MAP

4. Getting an include map

5. Getting info of file last update

6. getting realtime updates from CGI script

7. getting Tk to update the display

8. mapping dots to a map image

9. Getting tty name without using ttyname(3)

10. Even without binmode, txt file gets uploaded as BINARY instead of ASCII

11. Getting duration from start and and times and dates (without Date module)

12. serverside map 2 clientside map

 

 
Powered by phpBB® Forum Software