Table() MISC. REFERENCE MANUAL PAGES Table() NAME table _p_a_t_h_N_a_m_e ?_o_p_t_i_o_n_s? DESCRIPTION The table command creates a 2-dimensional grid of cells which can used to display, or update the contents of a Tcl array variable. The table can index into the array on either a row-first or column-first basis. The widget has an optional _s_e_l_e_c_t_e_d cell, the contents of which can optionally be edited. The widget supports a default style for the cells and also multiple _T_a_g_s, which can be used to change the foreground, background, font, relief and anchor for a row, column or cell. A cell _f_l_a_s_h can be set up so that newly changing cells will change colour for a few seconds. In order to obtain good performance, the Table widget sup- ports three drawing modes, two of which are fully Tk compa- tible. WIDGET COMMANDS _p_a_t_h_n_a_m_e configure ?_a_r_g _a_r_g ...? Configures the widget. These are the same options that can be specified on the original creation line for the widget. With no arguments it prints a list of confi- guration options and their values, with one argument it prints the value for that option. -background background colour -bg synonym for background -foreground foreground colour -fg synonym for colour -cursorbg The colour for the cursor -borderwidth borderwidth in pixels or units like mm -rows number of rows -cols number of cols Sun Release 4.1 Last change: 1 Table() MISC. REFERENCE MANUAL PAGES Table() -width default column width in characters in the default font -height height of default row in pixels (0 means set to font height) -colorigin column origin of top left corner of screen into the array variable (ie first column maps to array(x, $colorigin) -roworigin row origin of top left corner of screen into the array variable (ie first row maps to array(x, $roworigin) -maxwidth The max width in pixels that the window will request -maxwidth The max height in pixels that the window will request -rowtitle number of rows to use as the title -coltitle number of columns to use as a title -variable variable to attach to the array, will create it if it doesn't exist -relief the relief for the cells flat, raised etc. -font default font -anchor the anchor point for each of the cells -xscrollcmd the command issued to the xscrollbar, usually { set } -yscrollcmd the command issued to the yscrollbar, usually { set } Sun Release 4.1 Last change: 2 Table() MISC. REFERENCE MANUAL PAGES Table() -rowfirstmode if true, the index into the array is (row,col) else it is (col,row) _p_a_t_h_n_a_m_e width ?_a_r_g _a_r_g ...? sets the width of individual columns to a multiple of the width of a character in the default font. _p_a_t_h_n_a_m_e width shows the widths of all columns not set to the default width. _p_a_t_h_n_a_m_e width {_c_o_l _w_i_d_t_h} | col ... sets or resets the width of the specified column. _p_a_t_h_n_a_m_e height ?_a_r_g _a_r_g ...? sets the height of individual rows to a number of pix- els. _p_a_t_h_n_a_m_e height shows the heights of all rows not set to the default height. _p_a_t_h_n_a_m_e height {_r_o_w _w_i_d_t_h} | row sets or resets the height of the specified row. _p_a_t_h_n_a_m_e height _r_o_w shows the actual height of the row in pixels _p_a_t_h_n_a_m_e getwidth _c_o_l shows the actual width of the column in characters _p_a_t_h_n_a_m_e tag option ?_a_r_g _a_r_g ...? calls the tag functions to give various styles to a row, column or cell _p_a_t_h_n_a_m_e tag names shows the names of all defined tags _p_a_t_h_n_a_m_e _t_a_g _d_e_l_e_t_e _t_a_g deletes a tag. No error if the tag does not exist _p_a_t_h_n_a_m_e tag configure _t_a_g ?_a_r_g _a_r_g ... ? configures a tag. The options can all be set to null in which case the attribute from the default tag are used instead. Using _c_o_n_f_i_g_u_r_e with a new _t_a_g name adds the _t_a_g, with an existing _t_a_g it reconfigures it. If there are no arguments, it prints the _t_a_g configuration, with one argument, it prints the tag information for that attribute. The following attributes can be set per tag Sun Release 4.1 Last change: 3 Table() MISC. REFERENCE MANUAL PAGES Table() -background background colour -bg synonym for background -foregroundfR foreground colour -fg synonym for colour -font font for the tag -anchor anchor for the tag -relief the relief for the tag _p_a_t_h_n_a_m_e tag rowtag _t_a_g row ... With no arguments, prints out the list of rows that use the _t_a_g. Otherwise it sets the specified rows to use the tag. If tag is NULL ie {}, the rows are reset to use the default tag. _p_a_t_h_n_a_m_e tag coltag _t_a_g ? ... ? With no arguments, prints out the list of cols that use the _t_a_g. Otherwise it sets the specified cols to use the _t_a_g. If _t_a_g is NULL ie {}, the cols are reset to the default =_t_a_g. _p_a_t_h_n_a_m_e tag celltag _t_a_g ?{ } ... ? With no arguments, prints out the list of cells that use the _t_a_g. Otherwise it sets the specified cells to use the _t_a_g. If _t_a_g is NULL ie {}, the cells are reset to the default _t_a_g. _p_a_t_h_n_a_m_e toprow ?arg? Sets the topmost row in the main body of the display to the given argument. This is relative to the title row ie. if there are three title rows, and toprow is set to two, then the title rows will be followed by row five of the table. If there is no argument then it prints the value of the top row. _p_a_t_h_n_a_m_e leftcol ?arg? Sets the leftmost column in the main body of the display to the given argument. This is relative to the title column ie. if there are two title rows, and leftcol is set to four, then the title cols will be followed by row six of the table. If there is no Sun Release 4.1 Last change: 4 Table() MISC. REFERENCE MANUAL PAGES Table() argument then it prints the value of the left column. _p_a_t_h_n_a_m_e whatcell arg arg gives the row, column of the cell at cursor position (x,y) _p_a_t_h_n_a_m_e wheris arg arg gives the x, y, width and height of the cell at posi- tion (row, col) in pixels. Useful for positioning menus. _p_a_t_h_n_a_m_e setcell ?arg arg? With no arguments, prints out the location of the current /fIselected cell/fR. With two arguments, sets the /fIselected cell/fR to that (row, column) position _p_a_t_h_n_a_m_e icursor ?arg? With no arguments, prints out the location of the insertion cursor in the current cell. With one argu- ment, sets the cursor to that point in the string. 0 is before the first character, you can also use 'insert' or 'end' for the current insertion point or the end of the text _p_a_t_h_n_a_m_e insert arg arg the second argument is a text string which is inserted at the cursor position specified by the first argument. The cursor is then positioned after the new text. The position argument can be a number, 'insert' or 'end' _p_a_t_h_n_a_m_e delete arg ?arg? deletes text from the current selected cell. If only one argument is given, deletes the character after that argument, otherwise it deletes from the first argument to the second. The arguments can be a number, 'insert' or 'end'. _p_a_t_h_n_a_m_e reread rereads the old contents of the cell back into the editing buffer. Useful for a key binding when is pressed to abort the edit. _p_a_t_h_n_a_m_e editmode arg sets the editing mode to one of three options off no editing is allowed autoclear the first keypress deletes the text in the cell noclear the cell is not cleared on the first keypress Sun Release 4.1 Last change: 5 Table() MISC. REFERENCE MANUAL PAGES Table() _p_a_t_h_n_a_m_e drawmode arg sets the drawing mode to one of three options slow the table is drawn to an offscreen pixmap, using the tk bordering functions. This means there wil be no flashing, but this mode is slow for all but small tables. compatible the table is drawn directly to the screen, using the tk border functions it is faster, but the screen may flash on update fast the table is drawn directly to the screen and the borders are done with fast X calls, so they are always one pixel wide only. This mode provides best performance for large tables, but can flash on redraw and is not 100% Tk compatible on the border mode _p_a_t_h_n_a_m_e flash option ?arg? sets the parameters for the flashing for updating cells _p_a_t_h_n_a_m_e flash mode on|off turns flashing on or off. Note that flashing will only be turned on by this command if a tag is set up for the flashed cells to be painted in. _p_a_t_h_n_a_m_e flash tag tagname sets the flashing cells to be painted with this tag style. The tag must already exist. _p_a_t_h_n_a_m_e timeout arg sets the number of 1/4 second tics before a cell reverts to its usual style. _p_a_t_h_n_a_m_e batch on|off turns batch mode on or off. When it is on, updates are not forced out at any point, the widget waits for Tk to be idle before it repaints the screen. When batch mode is off, flashes, variable updates and the cursor changes are forced immediately to the screen. _p_a_t_h_n_a_m_e rowstretch option ?arg? sets the parameters for stretching rows to fill the assigned window space. Note that if you do not _p_a_c_k the table with -_f_i_l_l _b_o_t_h -_e_x_p_a_n_d _o_n the packing manager will not allocate extra space for the window and it will not stretch. _p_a_t_h_n_a_m_e rowstretch none Sun Release 4.1 Last change: 6 Table() MISC. REFERENCE MANUAL PAGES Table() Rows will not stretch to fill the assigned window space. If the rows are too narrow, there will be a blank space at the bottom of the table. _p_a_t_h_n_a_m_e rowstretch unset Only rows that do not have a specific height set will be stretched. _p_a_t_h_n_a_m_e rowstretch all All rows will be stretched by the same number of pixels to fill the window space allocated to the table. _p_a_t_h_n_a_m_e colstretch option sets the parameters for stretching columns to fill the assigned window space. Note that if you do not _p_a_c_k the table with -_f_i_l_l _b_o_t_h -_e_x_p_a_n_d _o_n the packing manager will not allocate extra space for the window and it will not stretch. _p_a_t_h_n_a_m_e colstretch none Columns will not stretch to fill the assigned win- dow space. If the columns are too narrow, there will be a blank space at the right of the table. _p_a_t_h_n_a_m_e colstretch unset Only columns that do not have a specific width set will be stretched. _p_a_t_h_n_a_m_e colstretch all All columns will be stretched by the same number of pixels to fill the window space allocated to the table. The initialization creates class bindings that give the fol- lowing default behaviour: [1] Clicking the mouse button in a cell moves the selection to that cell. [2] The left, right, up and down arrows move the selected cell. [3] Control-leftarrow and Control-rightarrow move the insertion cursor within the cell. [4] Backspace deletes the character before the insertion cursor. [5] Delete deletes the character after the insertion cur- sor. Sun Release 4.1 Last change: 7 Table() MISC. REFERENCE MANUAL PAGES Table() [6] Escape rereads the value from the array variable, dis- carding the edits that have been performed on the cell. [7] Control-minus and Control-equals decrease and increase the width of the column with the selected cell in it. Sun Release 4.1 Last change: 8