comp.lang.ada
 help / color / mirror / Atom feed
* gtkada and redrawing
@ 2011-08-23 14:12 tonyg
  2011-08-23 17:49 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: tonyg @ 2011-08-23 14:12 UTC (permalink / raw)



I have a toggle button and a Gentry in a Hbox. However I only want the
Gentry to appear when the toggle button is toggled and I want the
toggle button to fill the hbox when it is untoggled. If I use hide
then the toggle button stays the same size!

Any suggestions?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gtkada and redrawing
  2011-08-23 14:12 gtkada and redrawing tonyg
@ 2011-08-23 17:49 ` Dmitry A. Kazakov
  2011-08-23 19:03   ` tonyg
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry A. Kazakov @ 2011-08-23 17:49 UTC (permalink / raw)


On Tue, 23 Aug 2011 07:12:31 -0700 (PDT), tonyg wrote:

> I have a toggle button and a Gentry in a Hbox. However I only want the
> Gentry to appear when the toggle button is toggled and I want the
> toggle button to fill the hbox when it is untoggled. If I use hide
> then the toggle button stays the same size!

Remove it from the container (Hbox) using Remove (see Gtk.Container). Add
it back when needed. Do not forget to use Pack_Start/End for the button
with Fill and Expand set to true.

If you don't want to create the entry anew each time you need it, you can
Ref it. But do not forget to call Unref when Hbox or its container finally
disappear. There are many ways to do this. You can connect to Gtk_Box's
"destroy", you can derive from it your own type and place a hard reference
to the entry into it upon Initialize etc.

P.S. Actually it is always a good idea to derive new widgets from Gtk
containers. It looks as an overkill, but in a long run it pays off.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gtkada and redrawing
  2011-08-23 17:49 ` Dmitry A. Kazakov
@ 2011-08-23 19:03   ` tonyg
  0 siblings, 0 replies; 3+ messages in thread
From: tonyg @ 2011-08-23 19:03 UTC (permalink / raw)


On Aug 23, 6:49 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Tue, 23 Aug 2011 07:12:31 -0700 (PDT), tonyg wrote:
> > I have a toggle button and a Gentry in a Hbox. However I only want the
> > Gentry to appear when the toggle button is toggled and I want the
> > toggle button to fill the hbox when it is untoggled. If I use hide
> > then the toggle button stays the same size!
>
> Remove it from the container (Hbox) using Remove (see Gtk.Container). Add
> it back when needed. Do not forget to use Pack_Start/End for the button
> with Fill and Expand set to true.
>
> If you don't want to create the entry anew each time you need it, you can
> Ref it. But do not forget to call Unref when Hbox or its container finally
> disappear. There are many ways to do this. You can connect to Gtk_Box's
> "destroy", you can derive from it your own type and place a hard reference
> to the entry into it upon Initialize etc.
>
> P.S. Actually it is always a good idea to derive new widgets from Gtk
> containers. It looks as an overkill, but in a long run it pays off.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

Thanks Dmitry



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-23 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-23 14:12 gtkada and redrawing tonyg
2011-08-23 17:49 ` Dmitry A. Kazakov
2011-08-23 19:03   ` tonyg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox