Alright. Sorry for getting back to this little late. I again had some problems with my internet connection and had to get the service provider folks to test the modem for me. Now it has been set right (hopefully). Thereafter studying through the responses and trying out examples also took some time. However, below I have summarized what I've learnt from this thread so that any newbie like me will find it useful. My thanks to stefbv and anonymous monk for swiftly responding to which was essentially a four year old thread. My special thanks to zentara for successive follow-up responses and detailed examples. I've one question though which I've posted in the end.


What was learnt:

1. perldoc Tk::bind under section: "BINDING CALLBACKS AND SUBSTITUTIONS" lists all the fields that are accessible to a Perl/Tk programmer from XEvent object

2. perldoc Tk::TableMatrix under section: "Indices" lists all the formats of the paramaters to the widget commands such as selectionIncludes, selectionSet. The last format listed is: @x,y shows that @ is simply "at" but nothing to do with array data type.

3. The Tk::XEvent object is generic to any widget but not specific to Tk::TableMatrix. Therefore whenever mouse moves over a tablematrix widget (i.e. <Motion> event), the event object cannot specify on which row, column or cell the mouse is at but only the (x,y) co-ordinates in the widget where the mouse is at. This causes the methods selectionIncludes and selectionSet to use the format: @x,y by accessing x and y co-ordinate values from XEvent object

4. The selectionIncludes and selectionSet are cell specific i.e. the selection pertains to a cell covering the (x,y) co-ordinates. However, the option 'selectype' (which by default is set to 'cell') when set to 'row' causes the selectionSet to select the whole row

5. The 'curselection' method returns the sorted indices of all the cells in the selected row in the format: x,y for example: when 2nd row is selected in a table of 2-by-3 matrix, the first element of the array has value 1,0 and last element being of value 1,2 and the length of this array is 3. print ref w->curselection outputs: ARRAY which means curselection method returns a reference to an array but not the array itself. Therefore it has be de-referenced via the construct: @{...}

6. perldoc Tk::TableMatrix under section: "Tags" lists all the built-in tags. The selected row and it's content can be highlighted, if needed, using the 'sel' tag by
<I> my $tmatrix_select_font = [-family => 'Linotype Birka', -size => 15, -weight => 'bold', -slant => 'roman', -underline => 1, -overstrike => 0 ]; $w->tagConfigure('sel', -bg=>'cyan', -fg=>'blue', -font=>$tmatrix_ +select_font); </I>

One question I've though is
if the w->curselection method returns a reference to an array (as seen from: ref w->curselection;) then how come:
$,='|'; print w->curselection;
prints the contents of the array.??? i.e. the contents of the array are flattened into a string and printed instead of dumping the reference (something like: ARRAY(0x38cfc) i.e. what happens when the reference is used as a string).

Any answers ???

Many Thanks

In reply to Re^6: A TableMatrix row selection question by Anonymous Monk
in thread A TableMatrix row selection question by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.