Shiny Language Reference
Language Reference > User Interface > Memo Boxes
getmemoboxtextline
string getmemoboxtextline(int ID, int Line);
Returns the specified line of text from the memobox
The GETMEMOBOXTEXTLINE statement returns the line of text at the specified line number. Please read the following description carefully.
When using memoboxes on-screen they appear as multline edit controls. However the text data of a memobox control is actually stored as a single string, not as individual lines of text. This is necessary to allow dynamic formatting of the memobox. The size, shape, text bounding rect, font and other factors all affect the number of lines of text a memobox can display on screen at any one time. Each time Brass draws a memobox control it internally calculates how to chop up the text string into multiple lines so that it best fits the available display space. Because Brass allows non-fixed width fonts for the memobox control, a different number of characters may fit on each line. A row of 10 "W" characters takes up more pixel width than a row of 10 "I" characters. Therefore at any one time the contents of line N may differ from the contents of that same line at a different time, and inserting or removing characters elsewhere in the memobox contents will not necessarily alter the contents of that line.
The GETMEMOBOXTEXTLINE returns the text on the line Brass has calculated to be the line you have requested. The line count calculation is performed by Brass internally when the text is drawn; using this function does not cause Brass to perform any lengthy calculations.
Any trailing linefeed ("\n") will also be returned.
Parameters
ID
The control ID of the control you wish to retrieve the line count of
Line
The zero based line number to return the text of
Return Value
The text on the specified line, or an empty string if an error occurred.
Example Code
// Create the memo box X: 10, Y:10 and sized 150*70
int iMemoBoxID = creatememobox(1, 10, 10, 150, 70);
// Set the memobox text to "Hello World"
setcaption(iMemoBoxID, "Hello World");
// Get the text on line 1 - note the zero based index
string Text = getmemoboxtextline(iMemoBoxID, 0);