in reply to Re: Missing base classes when called from Tk
in thread Missing base classes when called from Tk
When I said "the routines are called like"...I meant my "key handler routine" is called by Tk with a calling sequence that looks like: "$main_win->handle_key($s, Ev('A'), Ev('K'))", where "$s" is the main "self" data structure/pointer."
i.e. The bind for my "handle_key" routine is:
From the man page on Tk::callbacks, I see:{ use Tk; #needed for "Ev" defines next code line $retval = $main_win -> bind('<Any-KeyPress>' => [\&handle_key, $s, Ev('A'), Ev('K')]); }
From my call sequence:Another use of arguments allows you to write generalized method +s which are easier to re-use: $a->bind("<Next>",['Next','Page']); $a->bind("<Down>",['Next','Line']); This will call $a->Next('Page') or $a->Next('Line') respectivel +y.
I pass the key_handler routine addr to Tk via the bind, but it is from the man pages I get that they are calling &handle_key as being called through the "$main_win" handle. I pass my 1 object (at top level is a singleton, I believe the terminology is) -- that contains the "database" I'm sequencing through. The routine that has the bind statement in it, is passed "$s" ($self), which it passes in a param list to &handle_key. I then try to invoke methods on the "$self" object that is passed in via the parameter list. It is some of those "methods" that the "call" should find in Base classes but isn't (doesn't seem to be searching through the base classes at all).
Did that clarify anything or where I might be using it incorrectly?
Sorry for any confusion....
L
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Missing base classes when called from Tk
by Anonymous Monk on Sep 27, 2007 at 16:48 UTC | |
by perl-diddler (Chaplain) on Sep 27, 2007 at 21:25 UTC |