Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Tk TableMatrix programmatically select row (color)

by Anonymous Monk
on Oct 17, 2020 at 12:29 UTC ( #11122945=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks

I want to programmatically select a row in a TableMatrix. I am doing this. It activates a cell, but it is okay in my scenario:


The cell gets selected, but the normal highlighting you get when you click with the mouse is not shown. I need it to be shown. I added the following

$t->tagRow('active', '0');

This highlight the row/cell, but in a different color respect when I click on it with the mouse. Is there something build-in, or do I have to define a new Tag with same color, etc.?

Replies are listed 'Best First'.
Re: Tk TableMatrix programmatically select row (color)
by kcott (Bishop) on Oct 18, 2020 at 03:07 UTC

    The prosaic description you've presented is insufficient for us to provide any concrete help; what we really need is a SSCCE.

    There are many ways colours may be initially specified. See Tk::options for items listed under STANDARD OPTIONS at the start of TableMatrix, and the remainder of that documentation for other options. There are also a variety of ways you may query and change colours: search for names that are, or include, cget and configure in both of those documents. Your post does not contain information about how you've used any of these.

    We also have no idea about your cell data: hard-coded text; text derived from some expression; embedded windows; or something else. This may be relevant to your problem but it's impossible to say at this point.

    Please keep your SSCCE short and to the point. A table consisting of a 3x3 matrix is probably sufficient. Your issue revolves around colours; we don't need to see options such as -bd, -relief, -ipady, -anchor, and so on. Your SSCCE needs to be runnable code that reproduces your problem; it must include the strict and warnings pragmata.

    It is often the case that writing an SSCCE that focusses on a specific problem will actually highlight the issue and present a solution. However, if that's not the case, the information requested should be sufficient for someone here to help you.

    — Ken

Re: Tk TableMatrix programmatically select row (color)
by Anonymous Monk on Oct 17, 2020 at 12:54 UTC

      Thank you. This helps. 'sel' is the key. However, I am wondering if I am overcomplicating things. Since now whenever another row is selected with any method available to the user, the row selected programmatically does not lose the tag, and so I have to deselect monitoring any input method that can be used to select another row (click of the mouse, up/down arrows, etc.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11122945]
Approved by johngg
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2021-01-27 01:06 GMT
Find Nodes?
    Voting Booth?