Shiny Language Reference

Language Reference > User Interface > Memo Boxes


memoboxgetat

string memoboxgetat(int ID, int Pos, int Count);

 

Returns characters from the memobox at the specified position

The MEMOBOXGETAT statement returns the specified number of characters at the specified byte position. To return all the text in the memobox, use the getcaption statement. This statement is specifically designed for returning substrings of the complete memobox contents, making it much easier to parse and process the text.

Note that any line feeds ("\n") in the range requested will be returned unmodified. If you do not want to deal with line feeds (for example, when writing the memobox text to a file), you may use the standard string management functions such as strreplace to remove them.

 

Parameters

ID

The control ID of the control you wish to modify

Pos

The character (byte) position within the memobox to begin returning text from. Remember that the byte position includes single bytes for line feeds (newlines, "\n"). Therefore a caption string of "Line 1\nLine 2" will only display 12 characters on screen, but consists of 13 bytes. Therefore to return text at the start of "Line 2", the position parameter should be integer 7.

Count

The number of characters to return. Remember that line feeds ("\n") are invisible but count as one character.

 

Return Value

The text in the requested range, or a blank string if the range was invalid.

 

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");

// Insert "big wide" between "Hello" and "World"
bool bRes = memoboxinsertat(iMemoBoxID, 5, " big wide");


// Return the substring "wide"
string SubString = memoboxgetat(iMemoBoxID, 10, 4);