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

Re: "Label" entries



Hi again,

2009/5/4 Emmanuel Rodriguez <emmanuel rodriguez gmail com>:
> I have released a new developer release (0.06_02) of Gtk2::Ex::Entry::Pango.
> It removes the default Pango markup when the entry is focused and it should
> also fix the dependencies problems with old versions of Gtk2 that are
> missing full Pango support.
>
> In the case where you are writing your own widget that mimics this
> functionality take a look at the function "set_layout_attributes" you will
> see a if with "$self->has_focus" it should allow you to implement an entry
> that has it's default Pango text removed once the widget gains focus without
> the need to add listeners.
> --
> Emmanuel Rodriguez
>

Wow, thanks for that! _Almost_ works like a charm, but there is one
little bug. Line 145:

my $EMPTY_ATTRLIST = ($Gtk2::VERSION >= 1.160)
	? Gtk2::Pango::AttrList->new()
	: Gtk2::Pango->parse_markup('')
;

doesn't work for versions below 1.160 since
Gtk2::Pango->parse_markup('') returns a list, and the last item of the
list is not the AttrList - it's the first. Needs to change to:

my ($EMPTY_ATTRLIST) = ($Gtk2::VERSION >= 1.160)
	? (Gtk2::Pango::AttrList->new())
	: Gtk2::Pango->parse_markup('')
;

Once that change is made all is good. Of course, people using up to
date Gtk2 installs won't notice at all :)

Thanks again.
MB


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