Shiny Language Reference
Language Reference > User Interface > Static Text
setstatictextfontcol
setstatictextfontcol(int ID, int RGBCol);
Synonyms:
int settextfontcol(int ID, int RGBCol);
Sets the colour of the font used for the static text control caption
The SETSTATICTEXTFONTCOL statement sets the RGB colour of the font used for the text of a control previously created with createstatictext. Refer to setcaption for further information on setting captions.
Any change to the font is carried out immediately, and the control is redrawn to reflect the new font colour.
Note that this statement is approximately 4 times faster than setstatictextfont if the only requirement is to change the RGB colour of the font.
Parameters
ID
The control ID of the static text control you wish to change the style of
RGBCol
An integer representing a packed RGB colour value (refer to the RGB statement) specifying the colour of the caption text
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));
// Set a caption for the control
setcaption(FirstTextID, "Here's some text");
// Set the caption font to red, 10pt Times New Roman Italic.
setstatictextfont(FirstTextID, "Times New Roman", 10, RGB(255, 0, 0), False, True);
// Change the caption font to blue
setstatictextfontcol(Id, RGB(0, 0, 255));