Re: finding the position of a (just created) widget



Is there a clean way to get a synchronous resize calculation done?

You might want to avoid this. My previous questions about this went into a
black hole. I struggled mightily with this and gave up partially defeated.

Too many things are going on and depending on what you want you may be
toast.

You have X windows, and Gtk widgets (which might have windows). Gtk does
things with "idle" procs so there is a delay between resizing something like
a GtkWindow->window and having the children resize.

I have tried using spin loops waiting for a resize to occur. These mostly
work.
A simple loop like

w^.width := -1;
gtk_resize_something...
WHILE w^.width < 0 DO
   gtk_main_iteration();
END;

The w^.width field is a data field filled by the configure_event, or
size_allocation signal handlers.

Has caused side effects depending on when and where you used such a loop.
Really strange effects. Like the window bouncing around the screen
(configuration events) until it stabilizes at 6, 19 with my window manager.
Considering window decorations that value is 0, 0. This is probably some
strange interaction with the window manager.

I have tried to use the gtk_container calls to do a synchronous resize, and
failed. Nothing happened.

I basically gave up the fine level of control and some features in the Gtk
implementation of my encapsulation library. I do use synchronization loops
waiting for configure or size_allocate signals, like my example.

Best Regards,
Norman Black
Stony Brook Software

----- Original Message -----
From: "Julian Bradfield" <jcb+gtk dcs ed ac uk>
To: <gtk-app-devel-list gnome org>
Sent: Tuesday, November 07, 2000 03:51 AM
Subject: finding the position of a (just created) widget


I want to show a widget, several layers down in a hierarchy
of containers, and then know immediately where it is, thus:
  gtk_widget_show(w); /* w is a previously unshown child of a box */
  /* here I want to know its position */
How can I do this?

The only thing I can think of so far is to iterate through the main
loop until I find some sensible values in the allocation record, but
that is unclean and requires me to disable all my other event handlers
that I don't want dispatched at that time.
Is there a clean way to get a synchronous resize calculation done?

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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