Commands Related to Tile Themes
For Tablelist Version 5.13
by
Csaba Nemethi
csaba.nemethi@t-online.deContents
- Overview
- The
tablelist::setThemeCommand - The
tablelist::getCurrentThemeCommand - The
tablelist::getThemesCommand - The
tablelist::setThemeDefaultsCommand
Overview
The commands described in this reference page should only be invoked when using the package Tablelist_tile. They enable you to set and query the current theme, to retrieve a list of the available themes, and to make sure that your widgets will have a theme-specific appearance.
The tablelist::setTheme
Command
- NAME
tablelist::setTheme– Set the current theme- SYNOPSIS
-
tablelist::setTheme theme
- DESCRIPTION
- This command sets the current theme to
theme, loading it if necessary. It is simply an alias forttk::setThemeortile::setTheme, depending on the tile version loaded into the interpreter. (Thetile::setThemecommand was renamed tottk::setThemein tile version 0.8.) - Being just an alias for a tile library procedure,
the
tablelist::setThemecommand does exactly the same as the original one: It loads the package implementing the given theme if needed, sets the theme to the specified one, and saves the latter in the variablettk::currentThemeortile::currentTheme, depending on the current tile version. - KEYWORDS
- tablelist, theme, tile
The
tablelist::getCurrentTheme Command
- NAME
tablelist::getCurrentTheme– Get the current theme- SYNOPSIS
-
tablelist::getCurrentTheme
- DESCRIPTION
- This command returns the value of the variable
ttk::currentThemeortile::currentTheme, depending on the tile version loaded into the interpreter. (The namespace containing the variablecurrentThemewas changed in tile version 0.8 fromtiletottk.) - KEYWORDS
- tablelist, theme, tile
The tablelist::getThemes
Command
- NAME
tablelist::getThemes– Get the themes registered in the package database- SYNOPSIS
-
tablelist::getThemes
- DESCRIPTION
- This command returns a list of the themes registered in the
package database. It is simply an alias for
ttk::themesortile::availableThemes, depending on the tile version loaded into the interpreter. (Thetile::availableThemescommand was renamed tottk::themesin tile version 0.8.) - KEYWORDS
- tablelist, theme, tile
tablelist::setThemeDefaults Command
- NAME
tablelist::setThemeDefaults– Set theme-specific default values of some tablelist configuration options- SYNOPSIS
-
tablelist::setThemeDefaults
- DESCRIPTION
- This command populates the array
tablelist::themeDefaultswith theme-specific default values of a series of Tablelist configuration options. The array names are the command-line names of the options, and the corresponding array values are the default values of these configuration options for the currently set tile theme. - The options whose names and values are written into
the array
tablelist::themeDefaultsare:-background,-foreground,-disabledforeground,-stripebackground,-selectbackground,-selectforeground,-selectborderwidth,-font,-labelforeground,-labelfont,-labelborderwidth,-labelpady,-arrowcolor,-arrowdisabledcolor,-arrowstyle, and-treestyle. In addition, the command sets some other array elements to theme-specific default values of the background and foreground colors of the column labels innormal,disabled,active, andpressedstates. (Tablelist needs the label colors for handling sort arrows and images with transparent background in the column labels.) - The
tablelist::setThemeDefaultscommand is invoked by Tablelist_tile automatically whenever a tablelist widget is createad or the<<ThemeChanged>>virtual event is received by a tablelist widget. In the latter case, the widget is reconfigured, using the new default values of those options that were not set explicitly to values different from the corresponding defaults. - Besides being used by the Tablelist_tile code, this
command can also be invoked in Tcl scripts, still before creating
any tile-based tablelist widget. By calling it explicitly and
using the values written by it into the array
tablelist::themeDefaults, you can make sure that classical Tk widgets, e.g., listbox and text, will have a theme-specific appearance, just like the tile widgets. For example, you can add some common configuration options to the option database as follows: -
tablelist::setThemeDefaults if {$tile::currentTheme eq "aqua"} { option add *Listbox.selectBackground \ $tablelist::themeDefaults(-selectbackground) option add *Listbox.selectForeground \ $tablelist::themeDefaults(-selectforeground) } else { option add *selectBackground $tablelist::themeDefaults(-selectbackground) option add *selectForeground $tablelist::themeDefaults(-selectforeground) } option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) - KEYWORDS
- tablelist, theme, tile