[Gtk-sharp-list] How do I control the text appearance of a Gtk.Entry widget ?

Jesper K. Pedersen linux at famped.dk
Sun Mar 9 04:10:22 EDT 2008


On Sat, 8 Mar 2008 18:22:54 -0500
"Michael Hutchinson" <m.j.hutchinson at gmail.com> wrote:

> On Tue, Mar 4, 2008 at 9:09 AM, Jesper K. Pedersen <linux at famped.dk>
> wrote:
> > I(newbie in Gtk#) am writing a small application where I need to
> > "highlight" entry of data in a Gtk.Entry widget.
> >
> > Any ideas of how to best achieve that?
> >
> > My first guess is that there is some means of controlling the style
> > of the entry but I am having trouble finding any examples of this)
> >
> > Any ideas are greatly appreciated
> 
> http://go-mono.com/docs/monodoc.ashx?link=M%3aGtk.Widget.ModifyBg(Gtk.StateType%2cGdk.Color)
> (though it might be ModifyBase, can't remember which style/state is
> used for the background of the Entry)
> 
> http://ometer.com/gtk-colors.html
> 
> Note also that setting styles will only affect the things that that
> widget actually draws, e.g. containers don't draw backgrounds.
> 

I am sorry - I should have been much more specific about my needs. The
highlighting by color I already got working, but I was looking for a
way to change the text size of the entry so it was larger than normal.

I did also manage after several hours of trial and error figure out
that it is somewhat cumbersome changing size of the displayed font in
the entry.

<-- excerpt from my code -->
Gtk.Style entstyle = entry_winWoDetail_wo.Style;

entstyle.FontDescription.Size = (int) ( entstyle.FontDescription.Size *
                                        Pango.Scale.Large );
entry_winWoDetail_wo.ModifyFont(entstyle.FontDescription);
entry_winWoDetail_ac.ModifyFont(entstyle.FontDescription);
entry_winWoDetail_description.ModifyFont(entstyle.FontDescription);
entry_winWoDetail_opened.ModifyFont(entstyle.FontDescription);


More information about the Gtk-sharp-list mailing list