Go up one levelGo to Previous Go to Next

TableList(n)

NAME

 
 TableList - A listbox based table widget

NAMESPACE

 
 util

PARENT CLASS

 
 util::ListboxWidget

SYNOPSIS

 
 TableList <path> ?options?

DESCRIPTION

 
 TableList is an itcl widget for displaying tabular information and
 headings in a Tk listbox. It lines up columns of data (specified in tcl
 list format) with column headings, optionally sorts the data by given
 columns, in a given order, can "hide" columns, rearrange columns, or
 display columns matching certain expressions.  You can even print the
 contents of the table.  This widget has been in use for a number of
 years and has grown to include quite a few features. It is well suited
 to displaying the results of database or catalog queries.


ITK COMPONENTS

 
 config_file
        This class creates an object for reading and writing an optional
        config file and managing table options.

 headbox
        Listbox used to display table headings.

 menubutton
        Optional menu with table operations.

STANDARD OPTIONS

 
 -borderwidth -exportselection -headingfont -headinglines -relief
 -selectmode -width

WIDGET OPTIONS

 
 -filtercmd
        Command to call to filter each row, hook to modify the row before
        it is displayed arg is is the name of the list holding the row
        (call by reference).

 -formats
        List of printf formats for columns (if not specified, will be
        calculated, see also -sizes).

 -headings
        Field names for heading - Note: specify before "-info".

 -hformats
        Print format string for the headings (set after -formats, defaults
        to same as $formats_) This might be different for headings if a
        column uses %f formats...

 -ignore_case
        Flag: if true, ignore case in matching (only works when
        -use_regexp 1 was specified).

 -info
        List of lists, one per line to display in table/list.

 -layoutcommand
        Command to call when layout options have been selected.

 -menubar
        Name of menubar frame in which to place table menubutton
        (optional).

 -order
        Set the order of the columns.

 -printcmd
        Default print command.

 -sizes
        List of column sizes (if not specified, will be calculated).

 -sort_by
        List of col index: sort table based on given columns (empty means
        don't sort).

 -sort_cols
        List of col names to sort by (empty means don't sort).

 -sort_order
        Set direction of sort: may be one of (increasing, decreasing) .

 -sortcommand
        Command to call when sort options have been selected.

 -static_col_sizes
        If true, reuse the calculated column sizes rather than recalculate
        for new info.

 -use_regexp
        Flag: if true, use regular exprs for matching, otherwise use
        wildcards.

PUBLIC METHODS

 
 add_row {newrow}
        Add a new row to the list and update the display.

 append_row {row}
        Append a row to the table. (call new_info when done).

 append_rows {rows}
        Append a list of rows to the table.

 calculate_format {}
        Calculate the print formats for table rows from the max column
        widths and options. The format string takes care of column widths,
        show/hide column and column separators.

        If the format was set explicitly (formats_flag_ = 1), use it
        otherwise, if the column widths are known (-sizes was set) use
        them, otherwise calculate the max column widths from the info
        list.

        The formats list uses %n$-s type format strings to set left/right
        alignment, width and order all at once, for example:  "%-10s" for
        left justify, "%.0s" effectively hides the item...

        If the Precision option is set for a column, assume it is a
        floating point value to be formatted like: %6.2f for example
        (precision = 2).

 clear {}
        Make the table empty.

 edit_row {}
        Pop up a dialog window to edit the values in the selected row.

 get_contents {}
        Return the contents of the table as a list of rows.

 get_headings {}
        Return the table headings.

 get_option {name option}
        Return the option value for the given heading name.  See above for
        list of Options...

 get_selected {}
        Return a list of the selected rows note: use disp_info_, since
        listbox contains formated lines.

 get_selected_with_rownum {}
        Return a list of {{rownum row} {rownum row} ...} for the selected
        rows.

 info_rows {}
        Return the number of rows being displayed in the table (after
        matching).

 layout_dialog {}
        Pop up a window to change the layout of the table and call the
        optional command when done.

 make_table_menu {}
        Add the table config menu items to the given menu.

 move_down {}
        Move the selected row down 1 row and make the changes in the info
        list.

 move_up {}
        Move the selected row up 1 row and make the changes in the info
        list.

 new_headings {}
        This method is called whenever the headings list changes.

 new_info {}
        This method is called whenever the info list changes.

 print {fd}
        Print the contents of the table to the open file descriptor.

 print_dialog {}
        Pop up a dialog to print the contents of the table to a printer or
        file.

 remove_row {row}
        Remove the given row (given by its value).

 remove_selected {}
        Remove the selected rows from the table and return them as a list
        of lists.

 restore_selection {}
        Restore the previously saved row selection.

 restore_yview {}
        Restore the previously saved scroll position .

 save_dialog {}
        Get a name from the user and use it to save the current
        configuration to a file under the user's home directory.

 save_selection {}
        Save a list of the currently selected rows so they can be restored
        later. .

 save_yview {}
        Save the current scroll position so it can be restored later. .

 search {name value}
        Search for and highlight the first row containing the given value
        in the named column.

 set_option {name option value}
        Set the option value for the given heading name

        Options:
         Show (bool)         - display or don't display the column Align
         (Left,Right)  - for left or right justify Separator           -
         set the separator string (goes after col) Wildcard            -
         only show rows where wildcard matches Precision           -
         number of places after the decimal for floating point values.

 set_options {headings option value}
        Same as set_option, but works on a list of column heading names.

 set_row {oldrow newrow}
        Replace the contents of the given row with the new info Note: this
        assumes that no 2 rows are exactly alike.  We can't use the row
        index here, since sorting and matching may mix things up too
        much.

 sort_dialog {}
        Pop up a dialog to sort the contents of the table.

 total_rows {}
        Return the total number of rows (before matching).

 update_sort_info {}
        Update the indexes ($sort_by) for the sort columns.

 xview {args}
        Scroll both the heading box and the main listbox syncronously
        (called for horizontal scrolling in listbox).

 yview {args}
        Scroll the listbox vertically.

PROTECTED METHODS

 
 delete_config {file}
        Get a name from the user and use it to save the current
        configuration to a file under the user's home directory.

 load_config {file}
        Load the named config file and update the display based on the new
        settings.

PROTECTED VARIABLES

 
 disp_info_
        List of info to display (after filtering and sorting).

 formats_
        Printf format string for table rows.

 formats_flag_
        Flag: true if the -formats option was specified so that we don't
        have to calculate the format string for a row.

 headbox_
        Box for headings.

 headings_
        Table column headings.

 hformats_
        Printf format string for table headings.

 hsize_
        Array(col) of heading width.

 info_
        Table contents as list of rows/cols.

 info_cols_
        Number of columns in table .

 info_rows_
        Number of rows in the info list (not including hidden rows).

 line_length_
        Length of a line in the table.

 match_all_
        Flag: true if match_list_ should match all rows.

 match_any_
        String used to match any string.

 match_list_
        List of glob expressions for matching rows to wildcards.

 match_proc_
        Method to use for matching rows (match_glob_ or match_regexp_).

 menubutton_
        Menubutton widget.

 num_cols_
        Number of columns.

 ord_
        Array(heading) of column order.

 order_
        List of indexes in row for headings (indep. of viewing order).

 saved_selection_
        Used for save_/restore_selection methods.

 saved_yview_
        Used for save_/restore_yview methods.

 size_
        Array(col) of col width.

 total_rows_
        Total number of rows, including hidden rows.

SEE ALSO

 
 ListboxWidget(n)

 


- - - - - -
Last change: 07 May 99

 


Go up one levelGo to Previous Go to Next

Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory