[Glade-users] Unable to fix the Text Entry widget size
Tristan Van Berkom
tvb at gnome.org
Fri Jan 27 14:16:37 UTC 2012
On Fri, Jan 27, 2012 at 11:10 PM, Manuel Ferrero <mferrero at reer.it> wrote:
> I'm struggling with alignment and size of a Text Entry widget: I simply
> can't reduce to exact size.
>
GtkEntry by default requires a fixed minimum size.
To change that minimum size you need to set the "width-chars"
property:
http://developer.gnome.org/gtk3/stable/GtkEntry.html#GtkEntry--width-chars
Notably this default behavior is not correctly documented, however
looking at gtkentry.c:gtk_entry_get_preferred_width() reveals
that there is a fallback minimum width used.
Cheers,
-Tristan
> What I want:
> http://img33.imageshack.us/img33/3597/simplemockup.png
>
> What I get:
> http://img684.imageshack.us/img684/1138/simplerw.png
>
> The Glade file for the second image:
> <?xml version="1.0" encoding="UTF-8"?>
> <interface>
> <requires lib="gtk+" version="2.24"/>
> <!-- interface-naming-policy project-wide -->
> <object class="GtkWindow" id="window1">
> <property name="can_focus">False</property>
> <property name="border_width">5</property>
> <signal name="delete-event" handler="on_window1_delete_event"
> swapped="no"/>
> <child>
> <object class="GtkVBox" id="vbox1">
> <property name="visible">True</property>
> <property name="can_focus">False</property>
> <child>
> <object class="GtkLabel" id="label1">
> <property name="visible">True</property>
> <property name="can_focus">False</property>
> <property name="xalign">0</property>
> <property name="yalign">0.46000000834465027</property>
> <property name="label" translatable="yes">Label</property>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">True</property>
> <property name="position">0</property>
> </packing>
> </child>
> <child>
> <object class="GtkHButtonBox" id="hbuttonbox1">
> <property name="visible">True</property>
> <property name="can_focus">False</property>
> <property name="layout_style">start</property>
> <child>
> <object class="GtkEntry" id="entry1">
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> <property name="invisible_char">â— </property>
> <property name="text" translatable="yes">text</property>
> <property name="primary_icon_activatable">False</property>
> <property name="secondary_icon_activatable">False</property>
> <property name="primary_icon_sensitive">True</property>
> <property name="secondary_icon_sensitive">True</property>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">False</property>
> <property name="position">0</property>
> </packing>
> </child>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">False</property>
> <property name="position">1</property>
> </packing>
> </child>
> <child>
> <object class="GtkHButtonBox" id="hbuttonbox2">
> <property name="visible">True</property>
> <property name="can_focus">False</property>
> <property name="spacing">5</property>
> <property name="layout_style">center</property>
> <child>
> <object class="GtkButton" id="button1">
> <property name="label" translatable="yes">button</property>
> <property name="use_action_appearance">False</property>
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> <property name="receives_default">True</property>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">False</property>
> <property name="position">0</property>
> </packing>
> </child>
> <child>
> <object class="GtkButton" id="button2">
> <property name="label" translatable="yes">button</property>
> <property name="use_action_appearance">False</property>
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> <property name="receives_default">True</property>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">False</property>
> <property name="position">1</property>
> </packing>
> </child>
> </object>
> <packing>
> <property name="expand">False</property>
> <property name="fill">True</property>
> <property name="position">2</property>
> </packing>
> </child>
> </object>
> </child>
> </object>
> </interface>
>
> How can I reduce the size of the Text Entry and fix it to the size of the
> button?
>
> TIA
> --
> Regards,
> Manuel Ferrero
> R&D department
>
> Reer SpA
> Tel. +39 011 2482215
> Fax. +39 011 859867
>
> L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe
> costituire reato.
> Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve
> essere considerato
> come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati
> se, via e-mail,
> ce ne comunicasse l'errata ricezione.
>
> The unauthorized use of this e-mail is prohibited and could constitute an
> offence.
> If you are not the intended recipient of this message its contents shall be
> understood as neither
> given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately
> in that case.
>
> _______________________________________________
> Glade-users maillist - Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
More information about the Glade-users
mailing list