![]() |
|
XP is just a number | |
PerlMonks |
TK::HList the best solution?by z3d (Scribe) |
on May 11, 2004 at 09:57 UTC ( #352377=perlquestion: print w/replies, xml ) | Need Help?? |
z3d has asked for the wisdom of the Perl Monks concerning the following question:
Friends (and strangers :) ),
I'm trying my hand at writing a perl-tk app, mostly for the shere fun of learning it, but have hit a stumbling block that I could use some advise on. My app is pulling in data that I'd like to display in a column/row format, allowing the user to simply double click the row they want to launch a new window that does some more fancy work/processing. I like the way Tk::HList looks, and have kludged it to do the job I want, but I'm wondering if there's a better way, or if I'm perhaps not using it correctly (I've read the pods, I've abused the widgets demo where applicable, and I don't have the resources to purchase "Mastering Tk" atm).
Right now, I have a code block like: which works, albeit in an ugly fashion. Through newbie experimentation I see that it passes the $entryID to my sub, and I've cobbled together what I believe to be a bad hack that associates the $entryID to a key in a hash, from which I can pull the relevant pieces of data to determine which row was hit and move forward. But is there a better way? The ideal would be to double click a row and pass it a specific piece of data rather than relying on the $entryID pass - am I doing this wrong? For those that wonder, I've tried using $hlist->configure(-command => mysub($whatiwant)), but this resulted in the desired command being run immediately for every row returned (not desirable when the number of rows can be between 1 and a really really large number). I confess that my thinking is a little too linear at times, so I don't immediately grok how to declare the command prior to having the (randomly) generated data available. Is there perhaps a better way to give the display I want with the functionality I need than by using Tk::HList? Thank you all in advance for your time and thoughts. z3d "I have never written bad code. There are merely unanticipated features."
Back to
Seekers of Perl Wisdom
|
|