Re: Getting screen position
- From: muppet <scott asofyet org>
- To: Steve Fox <drfickle k-lug org>
- Cc: gtk-perl list <gtk-perl-list gnome org>
- Subject: Re: Getting screen position
- Date: Thu, 05 Dec 2002 19:12:16 -0500
Steve Fox wrote:
On Thu, 2002-12-05 at 16:00, dams idm fr wrote:
my ($x, $y) = $window->window->get_position;
I mentioned that above as causing an error. Specifically,
Can't call method "get_position" on an undefined value at ./test.pl line
20.
Any ideas? Thanks.
the extra ->window is still correct.
you have hooked your signal to the "destroy" event --- this gets called
as the widget is being destroyed, specifically, i think, *after* then
window is off the screen. that means the GdkWindow doesn't exist anymore.
what you actually want, methinks, is the "delete-event", which is
exactly when the user clicks the "x" in the window manager.
$window->signal_connect("delete-event", sub { buhbye($window); });
when i did that, i got
GtkWindow
x: 53, y: 730
as the output.
/me slaps forehead for not having seen it earlier
in a larger application, you'll want to be able to save the window
position from more than just a window-manager kill, so this code should
actually go into your app's "quit" handler, and have the delete-event
signal call the same thing that "File->Quit" (or its equivalent in your
app) calls.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]