Home > Archive > PerlTk > May 2007 > partial highlighting of HList entry
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
partial highlighting of HList entry
|
|
|
| Hi All,
Is it possible to color a portion of the Hlist entry text?
Suppose my HList is as follows.
Root
|_ First Entry in the HList
|_ Second Entry in the HList
|_ Third Entry in the HList
\_ Last Entry in the HList.
Actually my requirement is as follows.
-- I have provided search mechanism in my HList. Now if I search
"Second", the entry "Second Entry in the HList" is selected. But I
want that the text "Second" is selected in some other color.
-- Is there any way to do it?
Thanks in advance.
/Joy
| |
| QoS@domain.invalid.com 2007-04-21, 10:02 pm |
|
Joy <joycseju@gmail.com> wrote in message-id:
<1177157615.240203.323890@b75g2000hsg.googlegroups.com>
>
>Hi All,
>Is it possible to color a portion of the Hlist entry text?
>
>Suppose my HList is as follows.
> Root
> |_ First Entry in the HList
> |_ Second Entry in the HList
> |_ Third Entry in the HList
> \_ Last Entry in the HList.
>
>Actually my requirement is as follows.
> -- I have provided search mechanism in my HList. Now if I search
>"Second", the entry "Second Entry in the HList" is selected. But I
>want that the text "Second" is selected in some other color.
> -- Is there any way to do it?
>
>Thanks in advance.
>
>/Joy
Perhaps what may work is ItemStyle
example:
$lb2_k2 = $lb2_msg->ItemStyle('text',
-anchor => 'e',
-selectforeground => '#fff000',
-background => '#ffffff',
-foreground => '#000000',
-font => '{Arial} 8',
);
$lb2_msg->add($k);
$lb2_msg->itemCreate($k, 0,
-itemtype => 'text',
-style => $lb2_k2,
-text => $file{$k}[0],
);
| |
| Slaven Rezic 2007-04-22, 8:01 am |
| Joy <joycseju@gmail.com> writes:
> Hi All,
> Is it possible to color a portion of the Hlist entry text?
>
> Suppose my HList is as follows.
> Root
> |_ First Entry in the HList
> |_ Second Entry in the HList
> |_ Third Entry in the HList
> \_ Last Entry in the HList.
>
> Actually my requirement is as follows.
> -- I have provided search mechanism in my HList. Now if I search
> "Second", the entry "Second Entry in the HList" is selected. But I
> want that the text "Second" is selected in some other color.
> -- Is there any way to do it?
No easy way. Itemstyles can only be used to color the contents of a
whole cell. A possible hack would be to overlay the cell with a widget
which allows to color individual characters (e.g. Tk::Text or
Tk::Canvas).
Regards,
Slaven
--
Slaven Rezic - slaven <at> rezic <dot> de
Visualize Makefiles with GraphViz:
http://user.cs.tu-berlin.de/~eserte...phViz-Makefile/
| |
|
|
|
|
|
|
|