Shiny Language Reference
Language Reference > User Interface > Edit Boxes
seteditboxtextrect
seteditboxtextrect(int ID, int X, int Y, int Width, int Height);
Sets a bounding rectangle for text
The SETEDITBOXTEXTRECT statement creates a bounding rectangle inside the edit control within which all text is constrained. This statement is useful when using custom drawn edit boxes. For example, if a custom drawn edit box is made up of a PNG that has a 10 pixel rounded border, SETEDITBOXTEXTRECT can be used to ensure the edit box text stays within the 10 pixel boundaries.
Note: Resizing the edit box using setcontrolsize will cause the edit box to discard any previously configured bounding rectangle. You must call SETEDITBOXTEXTRECT again with a new (or repeating the previous) bounding information.
If you do not use custom-drawn edit boxes, there is no need to call SETEDITBOXTEXTRECT. Brass automatically assigns a valid bounding rectangle for you.
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 edit box text will start. This is relative to the upper left corner of the edit box.
Y
The top left Y position from which rendering of the edit box text will start. This is relative to the upper left corner of the edit box.
Width
The maximum width of visible text in the editbox. 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 editbox. 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 seteditboxfont)
Return Value
None
Example Code
// Create a 50x20 editbox at 10, 10 and store it's ID
int Id = createeditbox(1, 10, 10, 50, 20);
// Set the editbox text to "Hello World"
setcaption(Id, "Hello World");
// Set the text to start at 1 pixel in from the left and
// one pixel down from the top, with a maximum width of
// 40 pixels and height of 18 pixels
seteditboxtextrect(Id, 1, 1, 40, 18);