|
Contents
TwBar parameters syntaxDescriptionThis page describes the bar parameters aimed at modifying the behavior of a bar. They can be set through the def string of function TwDefine using the syntax:
where They can also be set or get using the TwSetParam and TwGetParam functions, eg.:
Bar parameterslabelSyntax
DescriptionChanges the label of a bar, that is the title displayed on top of a bar. By default, the label is the name used when the bar was created. ExampleTwDefine(" mybar label='Engine properties' "); helpSyntax
DescriptionDefines the help message associated to a bar. This message will be displayed inside the Help bar automatically created to help the user.
You can also define a global help message. It will be displayed at the beginning of the Help bar. To define it, use the ExampleTwDefine(" mybar help='These properties defines the engine behavior' "); TwDefine(" GLOBAL help='I can write here a general description of my program.\n Welcome happy users!' "); colorSyntax
DescriptionChanges the color of a bar.
ExampleTwDefine(" mybar color='255 255 0' "); // yellow bar (transparent by default) TwDefine(" mybar color='0 128 255' alpha=128 "); // semi-transparent blue bar TwDefine(" mybar color='192 255 192' text=dark "); // light-green bar with dark text color alphaSyntax
DescriptionChanges the bar opacity.
Bar opacity a can vary from 0 for fully transparent to 255 for fully opaque. See also the ExampleTwDefine(" mybar alpha=0 "); // transparent bar TwDefine(" mybar alpha=128 "); // half-transparent bar TwDefine(" mybar alpha=255 "); // opaque bar textSyntax
DescriptionChanges text color.
Depending on your application background color and on bar color and alpha, bar text might be more readable if it is dark or light. This parameter allows to switch between the two modes. See also the ExampleTwDefine(" mybar text=dark "); // use dark text color TwDefine(" mybar text=light "); // use light text color positionSyntax
DescriptionMove a bar to a new position.
ExampleTwDefine(" mybar position='200 40' "); // move bar to position (200, 40) sizeSyntax
DescriptionChange the bar size.
ExampleTwDefine(" mybar size='240 320' "); // resize bar valueswidthSyntax
DescriptionChange the width of the bar right column used to display numerical values.
ExampleTwDefine(" mybar valueswidth=120 "); // set values column width fontsizeSyntax
DescriptionChange the size of the font used by the bars.
ExampleTwDefine(" GLOBAL fontsize=3 "); // use large font refreshSyntax
DescriptionChange the refresh rate of the bar.
Values displayed by a bar are automatically updated to reflect changes of their associated variables. ExampleTwDefine(" mybar refresh=1.5 "); // refresh the bar every 1.5 seconds visibleSyntax
DescriptionShow or hide a tweak bar. ExampleTwDefine(" mybar visible=false "); // mybar is hidden TwDefine(" mybar visible=true "); // mybar is displayed again iconifiedSyntax
DescriptionIconify or deiconify a tweak bar. ExampleTwDefine(" mybar iconified=true "); // mybar is iconified iconposSyntax
DescriptionChanges the place where icons of iconified bars are displayed.
Note that this parameter is applied to all bar icons. You can use the ExampleTwDefine(" GLOBAL iconpos=bottomright "); // icons go to bottom-right corner of the window iconalignSyntax
DescriptionChanges the alignment of icons of iconified bars. It can be vertical (the default), or horizontal.
Note that this parameter is applied to all bar icons. You can use the ExampleTwDefine(" GLOBAL iconalign=horizontal "); // icons will be aligned horizontally iconmarginSyntax
Description
Add a margin between borders of the window and icons of iconified bars.
Note that this parameter is applied to all bar icons. You can use the ExampleTwDefine(" GLOBAL iconmargin='8 16' "); // icons will be displayed at 8 and 16 pixels from the horizontal and vertical window borders respectively iconifiableSyntax
DescriptionAllow a bar to be iconified or not by the user. ExampleTwDefine(" mybar iconifiable=false "); // mybar cannot be iconified movableSyntax
DescriptionAllow a bar to be moved or not by the user. ExampleTwDefine(" mybar movable=false "); // mybar cannot be moved resizableSyntax
DescriptionAllow a bar to be resized or not by the user. ExampleTwDefine(" mybar resizable=false "); // mybar cannot be resized fontresizableSyntax
DescriptionAllow bar fonts to be resized or not by the user.
Note that this parameter is applied to all bars. You can use the ExampleTwDefine(" GLOBAL fontresizable=false "); // font cannot be resized alwaystopSyntax
DescriptionSet a bar to be always on top of the others. ExampleTwDefine(" mybar alwaystop=true "); // mybar is always on top alwaysbottomSyntax
DescriptionSet a bar to be always behind the others. ExampleTwDefine(" mybar alwaysbottom=true "); // mybar is always on bottom NotesNote on string parameters
If a parameter requires a Examples:
param=Simple // -> Simple
param='Two words' // -> Two words
param=`That's All Folks` // -> That's All Folks
param='He says "Hello!"' // -> He says "Hello!"
// note that in a c-string " are replaced by \" ie.: " param='He says \"Hello!\"' "
param="'aa'-"`"bb"-`'`cc`' // -> 'aa'-"bb"-`cc`
// note that in a c-string " are replaced by \" ie.: " param=\"'aa'-\"`\"bb\"-`'`cc`' "
Note on case sensitivity
See also |