Re: Getting and settings window positions



On 04/09/01 dLux wrote:
Can you  tell me  how I  can get the  current position  and size  of a
window  (before  destruction), and  how  I  can restore  them  (before
show)?

Something like:

my ($x, $y, $width, $height) = @{$window->allocation};
($x, $y) = $window->window->get_root_origin;

will get you the data. On app startup you just:
$window->set_default_size($width, $height);
$window->set_uposition($x, $y);

With enlightement you may need to use get_deskrelative_origin
instead of get_root_origin, I don't remeber the details....

I have an error when I wanted to use $window->get_parent_window:

Mon  Apr 9  01:05:39  2001 Gtk-LOG  **:  file  gtkwidget.c: line  3722
(gtk_widget_get_parent_window):  assertion  `widget->parent  !=  NULL'
failed. at (eval 7)[/usr/share/perl5..0/perl5db.pl:1510] line 2.

This is generated by Gtk+ itself, you don't want to call get_parent_window
on a toplevel widget because toplevels don't have parent windows.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]