Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tk: binding more than one action to a single key

Status
Not open for further replies.

xwax

Programmer
Oct 2, 2008
8
0
0
US
Just curious how or if you can bind multiple events to a single keystroke.

This does not work!
Code:
$this->bind('<Return>', [$test, 'that', Tk::Ev(['post'])] && sub { $this->historyAdd(); });

Basically, I need to have two things happen on a single keystroke.
Code:
$this->bind('<Return>', [$test, 'that', Tk::Ev(['post'])]);

and...

Code:
$this->bind('<Return>', sub { $this->historyAdd(); });
 
Usually I would do something like

Code:
$this->bind('<Return>', \&someCallback);
# +
$this->bind('<Return>', sub { $this->historyAdd(); });

as...

$this->bind('<Return>', sub {
   &someCallback(@_);
   $this->historyAdd();
});

But it depends on what this here is supposed to be doing: $this->bind('<Return>', [$test, 'that', Tk::Ev(['post'])]);

Is $test a coderef and 'that' and Tk::Ev() are arguments to that?

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top