Shiny Language Reference

Language Reference > User Interface > Static Text


setstatictextstyle

setstatictextstyle(int ID, int Style, bool Border, int RGB1, int RGB2);

 

Synonyms:

int settextstyle(int ID, int Style, bool Border, int RGB1, int RGB2);

 

Sets the visual style of a static text control

The SETSTATICTEXTSTYLE statement sets the visual style of a text control previously created with createstatictext. Note that using shaded, gradient controls is no slower during operation than using flat controls due to the way Brass manages visual elements of the display panel.

 

Parameters

ID

The control ID of the button you wish to change the style of

Style

An integer representing the style of the button, as follows:

0
A flat control with a solid colour of RGB1
 
1
Reserved. Do not use this value.
 
2
A shaded control with a gradient moving horizontally from left to right. The left of the gradient begins with the colour specifed by RGB1, and ends at the right of the gradient with the colour specified by RGB2.
 
3
A shaded control with a gradient moving vertically from top to bottom. The top of the gradient begins with the colour specifed by RGB1, and ends at the bottom of the gradient with the colour specified by RGB2.
 
4
A shaded control with a gradient moving diagonally from top left to bottom right. The top left of the gradient begins with the colour specifed by RGB1, and ends at the bottom right of the gradient with the colour specified by RGB2.
 
5
No background is used. The text is drawn directly into the display panel.

You may also using the following names instead of the integer values. These values are defined internally in SSEdit:

CTRL_FLAT
A flat control with a solid colour of RGB1
 
CTRL_CUSTOM
Reserved. Do not use this value.
 
CTRL_HGRAD
A shaded control with a gradient moving horizontally from left to right. The left of the gradient begins with the colour specifed by RGB1, and ends at the right of the gradient with the colour specified by RGB2.
 
CTRL_VGRAD
A shaded control with a gradient moving vertically from top to bottom. The top of the gradient begins with the colour specifed by RGB1, and ends at the bottom of the gradient with the colour specified by RGB2.
 
CTRL_DGRAD
A shaded control with a gradient moving diagonally from top left to bottom right. The top left of the gradient begins with the colour specifed by RGB1, and ends at the bottom right of the gradient with the colour specified by RGB2.
 
CTRL_EMPTY
No background is used. The text is drawn directly into the display panel.

 

Border

True if the control should have a border, otherwise False. A border is drawn as a single line, dark grey pixel around the edge of the control.

RGB1

An integer representing a packed RGB colour value (refer to the RGB statement). If the control style is flat, this colour is used for the background. If the control style is shaded this colour is used for the start of the gradient. If the control style is empty, this parameter is ignored.

RGB2

An integer representing a packed RGB colour value (refer to the RGB statement). If the control style is flat, this parameter is ignored. If the control style is shaded this colour is used for the end of the gradient. If the control style is empty, this parameter is ignored.

 

Return Value

None

 

Example Code

// Create a 150*40 control at 10, 10 and store its ID
int FirstTextID = createstatictext(1, 10, 10, 150, 40);

// Set the text to have a horizontal, grey shaded background with border
setstatictextstyle(FirstTextID, CTRL_HGRAD, True, RGB(100, 100, 100), RGB(200, 200, 200));

// Change it to have no background and no border
setstatictextstyle(FirstTextID, CTRL_EMPTY, False, 0, 0);