Shiny Language Reference
Language Reference > User Interface > Memo Boxes
setmemoboxtextrect
setmemoboxtextrect(int ID, int X, int Y, int Width, int Height);
Sets a bounding rectangle for text
The SETMEMOBOXTEXTRECT statement creates a bounding rectangle inside the memo box within which all text is constrained. This statement is useful when using custom drawn memo boxes. For example, if a custom drawn memo box is made up of a PNG that has a 10 pixel rounded border, SETMEMOBOXTEXTRECT can be used to ensure the memo box text stays within the 10 pixel boundaries.
Note: Resizing the memo box using setcontrolsize will cause it to discard any previously configured bounding rectangle. You must call SETMEMOBOXTEXTRECT again with new (or repeating the previous) bounding information.
If you do not use custom-drawn memo boxes and do not alter the scrollbar size, there is no need to call SETMEMOBOXTEXTRECT. Brass automatically assigns a valid bounding rectangle for you.
Brass automatically adjusts the bounding rectangle so that the memobox text does not collide with the scrollbar.
Parameters
ID
The control ID of the control you wish to change the style of
X
The top left X position from which rendering of the memo box text will start. This is relative to the upper left corner of the memo box.
Y
The top left Y position from which rendering of the memo box text will start. This is relative to the upper left corner of the memo box.
Width
The maximum width of visible text in the memo box. All text will be visibly constrained to X + Width. This does not affect the text itself, only the display.
Height
The maximum height of visible text in the memo box. All text will be visibly constrained to Y + Height. This does not affect the text itself, only the display. You are responsible for ensuring the specified height is compatible with the selected font (using setmemoboxfont)
Return Value
None
Example Code
// Create the memo box X: 10, Y:10 and sized 150*70
int iMemoBoxID = creatememobox(1, 10, 10, 150, 70);
// Set the text to start at 1 pixel in from the left and
// one pixel down from the top, with a maximum width of
// 100 pixels and height of 50 pixels
setmemoboxtextrect(iMemoBoxID, 1, 1, 100, 50);