Re: getting the requested size of a widget



Hi,

size with gtk_widget_size_request, and then using
gtk_widget_set_size_request

>each page contains a textview wrapped in a scrolledwindow

I use the technique you described in all my notebooks, with a wide range of pages, and it works fine. However I don't have textviews. This is a textview problem I guess. And probably there is a simple solution. You need to apply gtk_widget_size_request AFTER all your pages and notebook window are visible and realized, otherwise GTK does not know the size of things. And if you fixed the size of your textview widgets, it should in theory be [simple,possible] to come to a maximum size for the notebook...

Carlos
How do I get a widget to tell me truly how much size it would like?
gtk_widget_size_request does not appear to work.

Specifically, I have a dialog window that contains a notebook with
five pages; each page contains a textview wrapped in a scrolledwindow.
Some information arrives, I stuff it into the relevant pages, and then
pop up the dialog.
However, I would like the dialog to ask the window manager for as much
size as is needed to display the largest page without scrolling, not
just the currently selected page.

I thought I could do this by asking the page textview widgets their
size with gtk_widget_size_request, and then using
gtk_widget_set_size_request to tell the selected page to ask for the
maximum of these sizes.

However, the values I get back from gtk_widget_size_request seem
arbitrary. Some of them (usually the first pages to have their text
information updated) seem accurate, but the others are sometimes too
small (e.g (0,19), suggesting a requistion on the basis of no text),
or too large (a screen height or more), for which I have no idea whence it
came.

This is with gtk+ 2.14.4.





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