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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Selection in TkTable

Status
Not open for further replies.

dmaggian

Technical User
Jun 30, 2007
4
US
Hey all,

I'm new to the forum but not new to tcl though I've been away from it for some years. I'm writing a control application that needs to send data to a remote embedded device and using the tkTable widget for the first time as an interface.

I started with a variation of the buttons.tcl demo that comes in the 8.4 active state distribution. I need to send the data, one column at a time over tcp when I hit a send button. What I'd like the gui to do is highlight each column as it's being sent but I can't figure out how to do this from inside the program. When I set -selectmode to extended I can manually click on a column header and it will select the whole column. I have a small status field set up to show the row,column selections and it always looks like 0,1 or 0,19. However when I put a line in the program like

$t selection set 0,13

it selects just that one cell. So what do I need to do to highlight a whole column from inside the program.
 
I think you'll have to use the -selctioncommand option when you instantiate the table:
[ignore]
Command-Line Name:-selectioncommand or -selcmd Database Name: selectionCommand
Database Class: SelectionCommand

Specifies a command to evaluate when the selection is retrieved from a table via the selection mechanism (ie: evaluating «selection get"). The return value from this command will become the string passed on by the selection mechanism. It uses the %-substition model described in COMMAND SUBSTITUTION below. If an error occurs, a Tcl background error is generated and nothing is returned.
[/ignore]
That way, when you select any cell, you can program the command to identify the column, choose all cells in that column and parse them into a string that you will then do with what you will.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top