Adding findbar like the one from Firefox



I'm trying to add a findbar to the help viewer in my app like the one from Firefox.

I've got a window, with a vbox container. Packed into the vbox are an hbox that contains a toolbar, a two column table, another hbox that contains the findbar, and a drawing area that is used as a statusbar. Only the table is set to expand and fill if the window is resized.

Initially, the findbar is created but hidden. When the user selects find, I gtk_widget_show() the findbar and gtk_widget_hide() it when done. This didn't work correctly at first in GTK1.2 because the window would grow by the height of the findbar when it was shown. To get around the problem, I subtracted the size of the findbar from the vbox container before showing the widget. This worked (and is a total kludge).

I've been working on porting my app to GTK2 and the kludge no longer works. I commented out the code that resizes the vbox container and left it simply as a gtk_widget_show()/gtk_widget_hide() when showing/hiding the findbar. What happens is that the window shrinks a little when the findbar is shown and shrinks a little again (apparently the same amount) when it is hidden.

What is causing my window (or most likely my vbox container) to shrink? Is there a better way of packing in a widget that is to be shown/hidden that won't cause its parent to resize yet still allow any siblings to expand and shrink? TIA.

-Chinh Nguyen
 cnguyen stata com




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