Commands Related to Tile Themes

For Mentry Version 3.7

by

Csaba Nemethi

csaba.nemethi@t-online.de

Contents

Start page


Overview

The commands described in this reference page should only be invoked when using the package Mentry_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.

Contents     Start page


The mentry::setTheme Command

NAME
mentry::setTheme – Set the current theme
SYNOPSIS
mentry::setTheme theme
DESCRIPTION
This command sets the current theme to theme, loading it if necessary.  It is simply an alias for ttk::setTheme or tile::setTheme, depending on the tile version loaded into the interpreter.  (The tile::setTheme command was renamed to ttk::setTheme in tile version 0.8.)
Being just an alias for a tile library procedure, the mentry::setTheme command 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 variable ttk::currentTheme or tile::currentTheme, depending on the current tile version.
KEYWORDS
mentry, theme, tile

Contents     Start page


The mentry::getCurrentTheme Command

NAME
mentry::getCurrentTheme – Get the current theme
SYNOPSIS
mentry::getCurrentTheme
DESCRIPTION
This command returns the value of the variable ttk::currentTheme or tile::currentTheme, depending on the tile version loaded into the interpreter.  (The namespace containing the variable currentTheme was changed in tile version 0.8 from tile to ttk.)
KEYWORDS
mentry, theme, tile

Contents     Start page


The mentry::getThemes Command

NAME
mentry::getThemes – Get the themes registered in the package database
SYNOPSIS
mentry::getThemes
DESCRIPTION
This command returns a list of the themes registered in the package database.  It is simply an alias for ttk::themes or tile::availableThemes, depending on the tile version loaded into the interpreter.  (The tile::availableThemes command was renamed to ttk::themes in tile version 0.8.)
KEYWORDS
mentry, theme, tile

Contents     Start page


The mentry::setThemeDefaults Command

NAME
mentry::setThemeDefaults – Set theme-specific default values of some mentry configuration options
SYNOPSIS
mentry::setThemeDefaults
DESCRIPTION
This command populates the array mentry::themeDefaults with theme-specific default values of a series of Mentry 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 mentry::themeDefaults are: -background, -foreground, and -font.  In addition, the command sets some other array elements to theme-specific default values, needed for internal purposes, like updating the background and foreground colors of the label components of a mentry widget in disabled or readonly state; the corresponding array names are: -disabledbackground, -disabledforeground, and -readonlybackground.  Finally, the array values associated with the names -selectbackground, -selectforeground, and -selectborderwidth are not used by Mentry_tile, but might prove useful for other purposes, as described below.
The mentry::setThemeDefaults command is invoked by Mentry_tile automatically whenever a mentry widget is createad or the <<ThemeChanged>> virtual event is received by a mentry 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 Mentry_tile code, this command can also be invoked in Tcl scripts, still before creating any tile-based mentry widget.  By calling it explicitly and using the values written by it into the array mentry::themeDefaults, you can make sure that classical Tk widgets, e.g., 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:
mentry::setThemeDefaults
option add *Text.background   $mentry::themeDefaults(-background)
option add *Text.foreground   $mentry::themeDefaults(-foreground)
option add *Font              $mentry::themeDefaults(-font)
option add *selectBackground  $mentry::themeDefaults(-selectbackground)
option add *selectForeground  $mentry::themeDefaults(-selectforeground)
option add *selectBorderWidth $mentry::themeDefaults(-selectborderwidth)
KEYWORDS
mentry, theme, tile

Contents     Start page