My thanks to zentara, anonymous monk and stefbv for taking time to respond to my questions. I had problems with my internet connection. So couldn't respond earlier. Anyway, from your responses, I now understand,
1. perldoc Tk::bind under section: BINDING CALLBACKS AND SUBSTITUTIONS list all the fields that are accessible to a Perl/Tk programmer from XEvent object
2. The symbol @ in selectionIncludes('@' . $Ev->x.",".$Ev->y) has no special meaning but only what it is literally in spoken English (ie. @ simply means "at" and nothing to with array data type)
I hope this understanding of mine is correct.
However, I'm still having difficulty in understanding three lines of the code in http://perlmonks.com/?node_id=840707 viz:
1. $w->selectionIncludes( '@' . $Ev->x . "," . $Ev->y )
2. $w->selectionSet( '@' . $Ev->x . "," . $Ev->y )
3. my ($rc) = @{ $w->curselection };
As I've no background knowledge of pure Tcl/Tk, I'm unable to undertand what is said in the perldoc on Tk::TableMatrix with respect to these three selection methods. Can you folks please let me know what do these lines do (and how does it highlight the row and clicking on it retrieves the row number) from a Perl/Tk programmer perspective.
The line @{ $w->curselection } is baffling for me. Also commenting out the binding for <FocusOut> event doesn't appear to affect the program. Why is this so ?
Thanks in advance.
| [reply] [d/l] |
I'm still having difficulty in understanding three lines of the code:
1. $w->selectionIncludes( '@' . $Ev->x . "," . $Ev->y )
2. $w->selectionSet( '@' . $Ev->x . "," . $Ev->y )
3. my ($rc) = @{ $w->curselection };
Sometimes its just better to accept some things as internal magic. :-)
What I believe what is happening is that since it is in the sub for Motion, it is resetting the Ev at a low level so that the eventloop always picks up the change.
Just regard it as low-level manipulation of the widget, which is rarely seen up at the Perl programmers vantage point.
Have you tried commenting them out to see what effect each line has? Maybe perl/tk HLIST selections options will shed some light.
| [reply] [d/l] |
Hello Zentara,
Thank you for the quick response. Yes it is true that working with an abstract understanding helps many times. Therefore I have no problems accepting some things as internal magic so long as I understand what values and in what format I need to pass when calling these subroutines. For example, in the earlier mentioned thread: http://perlmonks.com/?node_id=840707 (i) what values and in what format I pass to select a column and be able to retrieve the column number that was selected (ii) similarly how to select an individual cell and retrieve the row,col of that cell.
But without even knowing what values and in what format to pass, I'm having difficulty even for abstract understanding at the programmer level. Yes, I did earlier try commenting out each of these three calls but the program fails to work. I'm taking a look at the HList selection example thread you mentioned. I hope it helps.
Meanwhile if somebody can tell me what values (and format) I need to pass to these three subroutines to get column selection, individual cell selection etc., it will be whole lot useful. Also, what does the @{...} syntax do ?? (the one used while calling curselection sub)
Thanks again
| [reply] |