Re: Tk::Hlist questions

[email protected]
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
It makes sense to me to stick with the matrix that I used to build the 
hlist and just work off of it to get both the number of list entries 
and 
text data for a given entry path.  The itemStyle suggestion provided 
exactly what I needed.  Thanks for taking to time to respond, it helped 
out alot.

----- Original Message -----
From: [email protected]
Date: Wednesday, September 21, 2005 2:39 pm
Subject: Re: Tk::Hlist questions

> Hmmm... interesting question.  There is of course, more than one 
> way to do it.
> You could use recursion to get the total number of entries in the 
> list.  i.e. get
> the children of the top level and recurse through each one, 
> returning a count
> of all the children...  I can't be positive, without looking at 
> the source, but the
> HList doesn't seem to have a method for this, so you need to roll 
> your own.
> 
> One way to get either column 0 or all columns would be to use a 
> hash of
> anonymous arrays.  The key to the hash being the HList entryPath they
> are stored under...
> 
> $col0 = ${$hash{$entryPath}}[0];
> 
> @cols = @{$hash{$entryPath}};
> 
> or somesuch...  You of course have to build the hash as you add 
> elements to
> the HList.
> 
> To answer your last question, I believe you need to create an 
> ItemStylefor each group of settings.  (i.e. black text on yellow 
> bg is one style, green
> text on black bg is another...)  This example uses the hex 
> representationfor the color (since there wasn't a close enough match):
> 
>    $idleBG = $hList->ItemStyle( 'text', -background => '#8f6f8f' );
> 
> Then you use it like
> 
>    $hList->itemCreate(
>                    $entry,
>                    $col,
>                    -itemtype => 'text',
>                    -text     => 'foo',
>                    -style    => $idleBG,
>                    );
> 
> 
> Hope this helps.
> 
> 
> > How can I get the total number of list entries in an Hlist?
> > 
> > Lets say I have 5 list entries each having 3 columns and I've 
> used the -
> > text option ($hlist->itemCreate( XX, XX, -text => "whatever");) 
> for 
> > each of the columns and then I call $hlist->info('selection'); 
> to get 
> > the list of selected entries.  How can I get the -text value for 
> either 
> > column 0 or all columns for each selected entry that was returned?
> > 
> > Right now I'm using seperate data arrays to achieve the above 
> two tasks.
> > 
> > Finally my least important question, is it possible to use 
> another 
> > foreground color for the -text in the columns one of the list 
> entries 
> > making it different from the rest?  This is basically to make it 
> stick 
> > out more, a way of showing priority, if you will.  I'm wondering 
> if at 
> > this point I should have used listbox -tabs
> > 
> > Thanks.
> > -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> > This message was posted through the Stanford campus mailing list
> > server.  If you wish to unsubscribe from this mailing list, send the
> > message body of "unsubscribe ptk" to [email protected]
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
> server.  If you wish to unsubscribe from this mailing list, send the
> message body of "unsubscribe ptk" to [email protected]
> 
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.