Shiny Language Reference

Language Reference > User Interface > Edit Boxes


createeditbox

int createeditbox(int ID, int X, int Y, int Width, int Height);

 

Creates a single line edit box in the display panel

The CREATEEDITBOX statement creates a user interface edit box in the plugin display panel. Edit boxes within Brass work exactly the same as the edit box in Windows. Brass edit boxes are always single line controls that store an arbitrary length of text. If the text is too long to fit in the edit box width, the user can scroll left and right using the arrow keys, or press CTRL with an arrow key to jump to the closest word. A word is a space followed by one or more letters. If you require an edit control that supports multiple lines of text refer to the memobox control.

Every user interface element is assigned a "control ID". This ID uniquely references an individual control and is the method by which you access and manage the control. This is analogous to the win32 HWND or HANDLE objects. Note that Brass controls are not Windows controls and can only be accessed via the appropriate Shiny language statements.

CREATEEDITBOX is the only statement you must call to create a working edit box in the display panel. The remaining edit box statements are provided for extra functionality and ease of use, however they are not mandatory.

Unlike Windows, Brass allows controls to be stacked on top of each other. Controls are ordered visually in the same order that they are created. Therefore to display smaller button A on top of larger editbox B, create editbox B before button A. This technique allows for controls-in-controls, for example to place a "Browse" button inside an edit box, where the edit box is used to select a folder.

 

Parameters

ID

Your preferred control ID for this control. You may specify any positive (greater than 0) integer for a control ID. If you specify a control ID that is already in use, the CREATEEDITBOX statement will return a new, unique ID for this control. Therefore you should assume that any value supplied for this parameter is only a suggestion, and the return value is the absolute control ID. You may specify integer 1 for every call to this statement, which will cause CREATEEDITBOX to return sequential control IDs for you, removing the need to store the last used control ID.

X

The X pixel position within the display panel of the top left of the edit control

Y

The Y pixel position within the display panel of the top left of the edit control

Width

The width in pixels of the edit control

Height

The height in pixels of the edit control

 

Return Value

The actual control ID assigned to this control.

 

Example Code

// Create a 50x20 edit box at 10, 10 and store it's ID
int Id = createeditbox(1, 10, 10, 50, 20);

// Create another button, supply 1 for the ID to receive the next free real ID
int NextId = createeditbox(1, 30, 30, 50, 20);