Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: tk:table get active cell

by biohisham (Priest)
on Sep 14, 2010 at 00:10 UTC ( [id://860049]=note: print w/replies, xml ) Need Help??


in reply to tk:table get active cell

Your foreach loop will only make your GUI widget print the last element in the array when you select an entry, you need to re-engineer that. You're not making use of the widget state variable $exportngram whose value toggles between 0 and 1 depending on whether it is unselected or selected but again, this might not be serving any purpose in the code snippet you posted.

I suggest you re-implement the same using a ListBox or a BrowsEntry widget..

#This snippet uses a listbox to deliver the required behavior. #You can double click a value to show or just use the print button. use strict; use warnings; use Tk; my $mainWindow = MainWindow->new(-title=>"Main Window"); my $listBox = $mainWindow->Scrolled( 'Listbox', -scrollbars=>'e' )->pack; $listBox->insert('end',qw(Nickle Dime Quarter)); $listBox->bind('<Double-1>', \&getActive); $mainWindow->Button( -text=>'print value', -command=>\&getActive, )->pack(); sub getActive{ my $currency; $currency = $listBox->get('active'); #get the current selection print $currency,"\n"; }; MainLoop;


Excellence is an Endeavor of Persistence. A Year-Old Monk :D .

Replies are listed 'Best First'.
Re^2: tk:table get active cell
by fanticla (Scribe) on Sep 14, 2010 at 05:42 UTC

    Thank you

    The <Double-1> works fine. The checkboxes will be used to select the instances of interest and then export them.

    Do you really mean there is no chance to get the active "cell", i.e. the active row $row, of a table? TK::Table information on the web are really sort of "too short" :( Or any chanche to insert checkbuttons in a listbox?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://860049]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-23 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found