Shiny Language Reference

Language Reference > User Interface > Memo Boxes


User Interface Memo Boxes

Creating and managing multiline edit controls

 

Just like with the other controls, understanding how to fit the memobox pieces together may not be immediately obvious. This download contains a sample plugin that demonstrates how to use memoboxes.

Download memoboxdemo.zip here

Inside the zip is one SSP plugin pack. Install the memoboxdemo.ssp pack file into Brass using the "Install SSP" option in the Brass "File" menu. This installs an SSE along with multiple PNG images that are required for the sample to work. When the SSP has been installed you can find the source code in <Brass Install Folder>\SSE\MemoBoxDemo.

The SSN demonstrates how to create and use simple memoboxes, as well as how to create and use custom drawn memoboxes with PNG images.

 

Handler prototype for Memo boxes

function Handler_Name(int iControlID, int iMessage)
{
}

Valid Messages for Memo boxes

SSEdit #define Value Meaning
 
MEMOBOX_GOTFOCUS 0 Passed when the control is left clicked to activate it
   
MEMOBOX_LOSTFOCUS 1 Passed when a previously activated control loses the input focus
   
MEMOBOX_ENTER 2 Passed when the user presses the Return key in a memobox, only when the
MEMOBOX_RETURN   memobox is set to not allow linefeeds
   
MEMOBOX_TEXTCHANGE 3 Passed when text in the control is changed

SSEdit contains a templatized handler function for use in your plugins. You may insert the template into your code using the SSEdit Code Wizard.

 

To manipulate the scrollbar attached to the memo control, refer to the scrollbar reference. To set and retrieve the complete text in a memobox, use the getcaption and setcaption statements.

creatememobox - Creates a memo box

setmemoboxstyle - Sets the visual style of a memobox

setmemoboxdrawfunc - Sets a memobox to be custom drawn, sets the custom draw handler

setmemoboxfont - Sets the font used for the memobox

setmemoboxfontcol - Sets the font colour used in the memobox

setmemoboxtextrect - Sets the bounding rectangle for all text in the memobox

resetmemobox - Resets the contents of a memobox to empty

setmemoboxcaretcol - Sets the colour of the caret

setmemoboxcaretpos - Sets the position of the caret within the memobox

getmemoboxcaretpos - Retrieves the position of the caret within the memobox

setmemoboxacceptret - Controls whether the memobox allows Enter/Return to create a new line

getmemoboxacceptret - Returns whether the memobox allows Enter/Return to create a new line

getmemoboxlinecount - Returns the number of lines required to format the memobox text for display

getmemoboxtextline - Retrieve the text of the specified line

memoboxinsertat - Insert a string at the specified position

memoboxremoveat - Remove characters at the specified position

memoboxgetat - Return a substring of N characters at the specified position

memoboxreplaceat - Replace a substring of N characters with a new string of M characters

memoboxlinefrompos - Calculates the line number for the given position (character index)

getmemoboxselstart - Returns the position of the first character selected in a selection range

getmemoboxselcount - Returns the number of characters selected in a selection range