I know that you can get a list of the selected item(s) like
so:
my @index = $tlist->info('selection');
But i have no idea how to get, say, the text of that/those
particular item(s). There is no get() method for
Tk::TList and none of the other available methods
in the docs are looking good. I am starting to believe that
you are not suppose to need to have a handle on the selected
object ... hopefully someone will come along soon and prove
this wrong. (and hopefully someone will finally write some
decent docs for Tk!)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
| [reply] [d/l] |
Once upon a time, I wrote the following ($l is a Tk::TList, Scrolled)
sub KosherINC {
my $l = shift;
@INC = ();
if( $l->index('end') ) { # index ain't documented (grr)
for(0 .. $l->index('end') ) {
push @INC, $l->entrycget($_ => '-text');
}
}
}
What it does is push onto @INC all the entries in the list. Isn't Tk wonderful? {grin}
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] [d/l] |
Hello PodMaster!
You are the great .$tl->entrycget($index->'-text') is work pretty well.
Everybody who are looking for this ,use this and thanks to PodMaster
Thanks,
| [reply] |
I read through the manpage on the TList widget, and learned the following:
- In order to know how to correctly extract content from the (set of) selected item(s), you have to know what sort of data they contain -- that is, what sort of data you put into the selected item(s): image, text, or "imagetext".
- The only features that set TList apart from a common, simple Listbox are: (1) the ability to assign distinct colors to individual list items (all items in a Listbox use the same colors), and (2) the ability to have items shown in a grid, with the indexing ordered horizontally or vertically (Listbox only displays a single-column vertical list).
If you don't happen to be using either of those two special features, then you might as well stick with using a plain old Listbox -- it's easier. If you do need those features, then Podmaster's sub-reply, together with your own knowledge about how you are putting items into the TList, should lead you to the answer. | [reply] |