[gtkada] Text Entry layout in a HBox problem (new user)

Charles Darcy charlie at mullum.com.au
Fri Feb 9 14:19:12 CET 2001


Arnaud Charlet wrote:

>
> >     Is there a way to set the maximum number of characters for a Text
> > Entry widget, such that the widget will not grow beyond the size needed
> > to display the max number of characters ?
>
> This is actually a general Gtk issue.

    Yes. I probably should have tried the Gtk list first. I'll give them a try
later, if I can't resolve my problem.


>
> Setting the max number of chars only tells the Gtk widget that no other
> chars
> can be entered by the user, it does not affect the visual size/aspect of the
>
> widget. This size is determined by the containers around it.

    I was hoping (rarely a useful exercise when coding) that if the widget
knew it could only display, for instance, 4 characters, it might limit its
size request to just enough space to display that much text. My hope was in
vain, yet I feel there must be a way to give the first Text Entry the lions
share of available space, when the second Text Entry is known to be
constrained to only a few characters.

    At the moment, only half the text in the first widget is displayed, and
the second widget is mostly empty space. I suspect the correct solution may
become obvious when I become more familiar with Gtk (at least I hope so :-).



Preben Randhol wrote:

>
> Try:
>
>    Pack_Start (HBox, Entry1, True, True, 0);
>    Pack_End   (HBox, Entryr2, False, False, 0);
> Try:
>
>    Pack_Start (HBox, Entry1, True, True, 0);
>    Pack_End   (HBox, Entryr2, False, False, 0);
>

    Thanks for the tip, but when I tried this the widget sizes remained
unchanged.


>
> PS: I'm forwarding this mail to you as it looks like the gtkada list is
> down at the moment. Nice to hear that you convert an app from C++ to Ada
> and not the other way :-)
>

    You mean people actually convert from Ada to C++ ???  (:->)

    I grudgingly switched from Ada83 to C++, primarily for the sake of
inheritance, back in the early 90's. You may imagine how delighted I was to
discover Ada95 (only late last year, if you can believe it).

    Your signature line ...

>                  «For me, Ada95 puts back the joy in programming.»

                                        ... describes my feeling perfectly.


regards,

Charlie.





More information about the gtkada mailing list