Home > Archive > PerlTk > September 2004 > Listbox: alternation of line colours?
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 |
Listbox: alternation of line colours?
|
|
|
| Hi all,
I want to make a listbox display easier to read by alternating the
background colour between consecutive lines, much like the shades
of grey or green used on endless paper for accounting ledgers.
The colouration should be generated automatically and should not be
with highlighting via mouse cursor.
Is this possible in the Listbox widget or is the Text widget mandatory
for this kind of enhanced text display?
Thank you again,
Oliver.
PS: pointers to documentation or examples are welcome - yet browsing
my Tk stuff did not really help.
BTW, the target installation is ASPerl 5.8.0 and the Tk code that came
with it. (The target machine where this platform is installed stands in
a remote corner of this world without connection to the net, and thus
there is no chance to upgrade. Only thingies small enough to fit on
a floppy disk (like PerlTk scripts!) are feasible.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
| |
| Marc Dashevsky 2004-09-17, 8:58 pm |
| In article <2r0jhuF14oq77U2@uni-berlin.de>, corff@cis.fu-berlin.de says...
> Hi all,
>
> I want to make a listbox display easier to read by alternating the
> background colour between consecutive lines, much like the shades
> of grey or green used on endless paper for accounting ledgers.
>
> The colouration should be generated automatically and should not be
> with highlighting via mouse cursor.
>
> Is this possible in the Listbox widget or is the Text widget mandatory
> for this kind of enhanced text display?
>
> Thank you again,
>
> Oliver.
>
> PS: pointers to documentation or examples are welcome - yet browsing
> my Tk stuff did not really help.
Does your Listbox pod discuss the itemconfigure() method?
I'm running Tk 804.027 and it does.
--
Go to http://MarcDashevsky.com to send me e-mail.
| |
|
| Marc Dashevsky <usenet@marcdashevsky.com> wrote:
: Does your Listbox pod discuss the itemconfigure() method?
: I'm running Tk 804.027 and it does.
Hi Marc,
My PerlTk version does not yet offer itemconfigure() for Listbox,
so I helped myself my using a Read Only text widget, defining an
alternate colour, abd filling it like this:
$lineDisplay=$editwindow->Scrolled(
"ROText",
-scrollbars => 'osw',
-wrap => 'none',
)pack;
$lineDisplay->tagConfigure('greyline', -background => 'grey95');
for (@lines) {
$greyline="";
$lineDisplay->insert('end',"$mongol{$line}\n",$greyline);
$greyline='greyline;
$lineDisplay->insert('end',"$kirill{$line}\n",$greyline);
}
which works really smoothly.
A working example can be seen at
http://userpage.fu-berlin.de/~corff...le/scalars.html
The only thing missing is that I have to make the text window scroll
when I operate the selection buttons in the navigation window.
Oliver.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
|
|
|
|
|