EasyGUI  Version v1.0
Edit text

Single-line edit text widget. More...

Data Structures

struct  gui_edittext_t
 Edittext object structure. More...
 

Enumerations

enum  gui_edittext_color_t { GUI_EDITTEXT_COLOR_BG = 0x00, GUI_EDITTEXT_COLOR_FG, GUI_EDITTEXT_COLOR_BORDER }
 Edit text color list enumeration. More...
 
enum  gui_edittext_valign_t { GUI_EDITTEXT_VALIGN_TOP = GUI_VALIGN_TOP, GUI_EDITTEXT_VALIGN_CENTER = GUI_VALIGN_CENTER, GUI_EDITTEXT_VALIGN_BOTTOM = GUI_VALIGN_BOTTOM }
 Vertical align for edit text inside box. More...
 
enum  gui_edittext_halign_t { GUI_EDITTEXT_HALIGN_LEFT = GUI_HALIGN_LEFT, GUI_EDITTEXT_HALIGN_CENTER = GUI_HALIGN_CENTER, GUI_EDITTEXT_HALIGN_RIGHT = GUI_HALIGN_RIGHT }
 Horizontal align for edit text inside box. More...
 

Functions

gui_handle_p gui_edittext_create (gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
 Create new edit text widget. More...
 
uint8_t gui_edittext_setcolor (gui_handle_p h, gui_edittext_color_t index, gui_color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_edittext_setmultiline (gui_handle_p h, uint8_t multiline)
 Set edit text to multi line mode. More...
 
uint8_t gui_edittext_setvalign (gui_handle_p h, gui_edittext_valign_t align)
 Set vertical align for text inside text box. More...
 
uint8_t gui_edittext_sethalign (gui_handle_p h, gui_edittext_halign_t align)
 Set horizontal align for text inside text box. More...
 

Detailed Description

Single-line edit text widget.

Edit text widget can receive keyboard input in unicode format and display text in single line.

image_widget_edittext.png
Text view in focused state ready to accept keyboard entries (unicode)

Example code of image above:

Enumeration Type Documentation

◆ gui_edittext_color_t

Edit text color list enumeration.

Enumerator
GUI_EDITTEXT_COLOR_BG 

Background color index

GUI_EDITTEXT_COLOR_FG 

Foreground color index

GUI_EDITTEXT_COLOR_BORDER 

Border color index

◆ gui_edittext_halign_t

Horizontal align for edit text inside box.

Enumerator
GUI_EDITTEXT_HALIGN_LEFT 

Horizontal align left, default value

GUI_EDITTEXT_HALIGN_CENTER 

Horizontal align center

GUI_EDITTEXT_HALIGN_RIGHT 

Horizontal align right

◆ gui_edittext_valign_t

Vertical align for edit text inside box.

Enumerator
GUI_EDITTEXT_VALIGN_TOP 

Vertical align top, default value

GUI_EDITTEXT_VALIGN_CENTER 

Vertical align center

GUI_EDITTEXT_VALIGN_BOTTOM 

Vertical align bottom

Function Documentation

◆ gui_edittext_create()

gui_handle_p gui_edittext_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
uint16_t  flags 
)

Create new edit text widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for widget creation
Returns
Widget handle on success, NULL otherwise

◆ gui_edittext_setcolor()

uint8_t gui_edittext_setcolor ( gui_handle_p  h,
gui_edittext_color_t  index,
gui_color_t  color 
)

Set color to specific part of widget.

Parameters
[in]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_edittext_sethalign()

uint8_t gui_edittext_sethalign ( gui_handle_p  h,
gui_edittext_halign_t  align 
)

Set horizontal align for text inside text box.

Parameters
[in]hWidget handle
[in]alignHorizontal align
Returns
1 on success, 0 otherwise

◆ gui_edittext_setmultiline()

uint8_t gui_edittext_setmultiline ( gui_handle_p  h,
uint8_t  multiline 
)

Set edit text to multi line mode.

Note
When multiline is enabled, vertical text alignment is always top positioned
Parameters
[in]hWidget handle
[in]multilineSet to 1 to enable multiline or 0 to disable
Returns
1 on success, 0 otherwise

◆ gui_edittext_setvalign()

uint8_t gui_edittext_setvalign ( gui_handle_p  h,
gui_edittext_valign_t  align 
)

Set vertical align for text inside text box.

Parameters
[in]hWidget handle
[in]alignVertical align
Returns
1 on success, 0 otherwise