Re: get size of widget before first draw



On Mon, Jun 11, 2001 at 03:34:29PM -0500 Steve & Patti Getzinger wrote:

What about creating the widget and before showing it realizing it. Then
get it's size and do what you need to do and show it.

Steve 

Rolf Schäuble wrote:

Hi.
I have to know how big a widget will be before it is drawn the first time. I need this to set its 
position to the middle of the screen. If I ask for its size after creating it, i get some 20x22 size. If 
I check its size after the first draw event, I get a reasonable size. Is there any way to get this before 
it's drawn, so I can set its position without the user being able to see the movement of the widget?

Thank for your time and help


  win = create_window();

  gtk_widget_realize(win);

  // maybe set window decoration
  if (win->window)
    gdk_window_set_decorations(win->window, 0);

  // center it on the screen
  gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER);

  gtk_widget_show(win);

Markus.




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