Shiny Language Reference
Language Reference > User Interface > List Boxes
setlistboxfont
setlistboxfont(int ID, string Font, int Size, int RGBCol, bool Bold, bool Italic);
Sets the font used for the list box text
The SETLISTBOXFONT statement sets the font used for the text of all items in a list box.
Any change to the font is carried out immediately, and the control is redrawn to reflect the new font style. It is your responsibility to ensure the font chosen for a list box fits inside the control itself. Setting a font too large for the list box will cause all pixels outside of the list box boundary to be clipped.
The font used for the listbox controls the number of visible lines/items. To fine-tune the position and clipping of text items in the control, refer to the setlistboxtextrect statement.
Note that the setlistboxfontcol statement is approximately 4 times faster than this statement if the only requirement is to change the RGB colour of the font.
Parameters
ID
The control ID of the control you wish to change the style of
Font
The name of the font typeface
Size
The point size of the font
RGBCol
An integer representing a packed RGB colour value (refer to the RGB statement) specifying the colour of the textBold
True if the caption text should be bold, otherwise False.
Italic
True if the caption text should be italic, otherwise False.
Return Value
None
Example Code
// Create the edit box X: 10, Y:10 and sized 200*120
int iListBoxID = createlistbox(1, 10, 10, 200, 120);
// Use a 10 point, bright blue Arial font
setlistboxfont(iListBoxID, "Arial", 10, RGB(0, 0, 200), False, False);