githubEdit

Edit Box Series Control Class

Brief Introduction to Edit Box Control

Edit box control is one of the essential controls in GUI system, which is mainly used to receive character input of the users and realize the function of user interaction and text edition. In Realization, it is divided into single line edit and multi-line edit. Single line edit box is used to receive single line text input with comparatively simple user content, in comparison, multi-line text is used to receive complicated and large volume of text input.

alt

mEdit

  • Control window class: NCSCTRL_EDIT

  • Control English name: Edit

  • Brief introduction: Foundation class of edit box series controls, it is the abstract parent class of single line edit box and multi-line edit box, which defines the common use interface of the two.

  • Schematic diagram: Abstract class, and cannot be used directly.

Style of mEdit

It is inherited from the style of mScrollView

Style name

miniStudio property name

Explanation

NCSS_EDIT_LEFT

Align->Left

Left aligned

NCSS_EDIT_CENTER

Align->Center

Horizontal centering

NCSS_EDIT_RIGHT

Align->Right

Right aligned

NCSS_EDIT_UPPERCASE

Case->Upper

The input content is automatically converted to capital letter

NCSS_EDIT_LOWERCASE

Case->Lower

The input content is automatically converted to lower case letter

NCSS_EDIT_NOHIDESEL

HideSel->FALSE

When the edit box loses focus, the selected content still remains selected status

NCSS_EDIT_READONLY

ReadOnly->TRUE

The content is read only

NCSS_EDIT_BASELINE

BaseLine->TRUE

Content underlined display

Property of mEdit

It is inherited from the property of mScrollView.

Property

miniStudio property name

Type

Authority

Explanation

NCSP_EDIT_LIMITTEXT

MaxLength

int

RW

Character number limit value

NCSP_EDIT_CARETPOS

--

int

RW

Cursor location

Event of mEdit

It is inherited from the event of mScrollView.

Event ID

Parameter

Explanation

NCSN_EDIT_CHANGE

--

Content changes

NCSN_EDIT_CONTCHANGED

--

When edit loses the focus, the content changes

NCSN_EDIT_UPDATE

--

The content is refreshed when changed through setText and resetContent method or the property is changed

NCSN_EDIT_SELCHANGED

--

The selected part changes

NCSN_EDIT_MAXTEXT

--

Character number is saturated

NCSN_EDIT_SETFOCUS

--

Get the focus

NCSN_EDIT_KILLFOCUS

--

Lose the focus

Method of mEdit

It is inherited from the method ofmScrollView.

setContent

  • Parameter

    • str -- literal content displayed in edi

    • start -- display starting location (relative to the starting location of str), 0 represents starting from the beginning

    • len -- display character number, -1 represents ending till the end of str

  • Explanation: Set the display content of the edit box. The method will get altogether characters from No. character location from str character string, and replace the existing content in edit.

  • Example:

replaceText

  • Parameter

    • str -- source character string used for replacement

    • start -- deviation of the source text used for replacement relative to str, 0 represents starting from the beginning

    • len -- length used to the source text, -1 represents starting from start and ending till str

    • replace_start -- replace the starting location (relative to the existing content in edit)

    • replace_end -- replace the ending location (relative to the existing content in edit)

  • Explanation: Replacement of character string, the method will get altogether characters starting from No. character location from str character string, and replaces the existing content from to in edit. Str is the character string to be replaced to, start is the starting location relative to str, 0 represents starting from the beginning, len is the length, -1 represents ending till the end of str, replace_start and replace_end are the starting point and ending point of the location to be replaced, and they are location deviation relative to the existing text content in edit.

  • Example:

insert

  • Parameter

    • str -- source character string to be inserted

    • start -- starting location of the source text used, 0 represents starting from the beginning

    • len -- length of the source text used, -1 represents starting from start, and ending till str

    • at -- location of the insert point (relative to the existing content in edit), -1 represents the end

  • Explanation: Insert of the character string, the method will get altogether characters starting from No. character location in str character string, and it is inserting into location of No. character of the existing content in edit. Str is the character string to be inserted, start is the starting location relative to str, 0 represents starting from the beginning, len is the length, -1 represents ending till the end of str, at parameter is the location to insert, and it is the location deviation relative to the existing text content in edit

  • Example:

append

  • Parameter

    • str -- source character string to append

    • start -- starting location of the source text used, 0 represents starting from the beginning

    • len -- length of the source text used, -1 represents starting from start and ending till str

  • Explanation: Append the character string, the method will get altogether characters starting from No. character location from str character string, and append to after the existing content in edit. str is the character string to append, start is the starting location relative to str, 0 represents starting from the beginning, len is the length, and -1 represents ending till the end of str.

  • Example:

getTextLength

  • Explanation: Get length of the content of the character string in Edit

  • Example:

getContent

  • Parameter:

    • strbuff -- get storage location to the character string (storage space shall be distributed in advance)

    • buff_len -- size of strbuff

    • start -- starting location of the obtained content

    • end -- ending location of the obtained content

  • Explanation: Get character string content in edit, and get the content from to location from the existing content and write into strbuff, and the maximum number to write in is limited to buff_len.

  • Example:

setSel and getSel

  • Parameter:

    • start \end -- starting point and ending point of the selected region

    • pstart\pend -- starting point and ending point of the selected region, used for function return

  • Explanation: Set and get the region of the selected text, and the last two parameters correspond to the starting point and ending point of the selected region respectively

  • Example:

setMargin

  • Parameter:

    • left,top,right,bottom -- margin of left, top, right and bottom, the parameter is not a concept of rectangle, and it just continues to use the data structure of rectangle for the convenience of parameter transmission

  • Explanation: Set left, top, right and bottom margin of the edit region

  • Example:

copy, paste, and cut

Cut, copy and paste aim at the operation of the selected region. In edit, a group of operation set using minigui cut board is realized by default, and the users can set operation set realized by itself through setCopyPaste.

makevisible

  • Parameter:

    • pos -- location needs to be visible

  • Explanation: Control scrolling of the edit region, making the characters of the location pos become visible.

  • Example:

mSlEdit

  • Control window class: NCSCTRL_SLEDIT

  • Control English name: Single Line Edit Or SlEdit

  • Brief introduction: Single line text edit box

  • Schematic diagram:

alt

Style of mSIEdit

It is inherited from the style of mEdit.

Style name

miniStudio property name

Explanation

NCSS_SLEDIT_PASSWORD

Password->TRUE

Content of the edit box is shield displayed in the mode of password input

NCSS_SLEDIT_AUTOSELECT

AutoSelect->TRUE

Automatic selected style, after the focus is obtained, the text automatically becomes selected status

Property of mSIEdit

It is inherited from the property of mEdit.

Property

miniStudio property name

Type

Authority

Explanation

NCSP_SLEDIT_TIPTEXT

ToolTip

char *

RW

Prompt information character string, when there is no input, information used to prompt users

NCSP_SLEDIT_PWDCHAR

PasswordChar

char

RW

Character displayed by pass word, only NCSS_SLEDIT_PASSWORD style is valid, * by default

Event of mSIEdit

It is inherited from the event of mEdit.

Event ID

Parameter

explanation

NCSN_SLEDIT_ENTER

--

Capture enter key information

Method of mSIEdit

It is inherited from the method of mEdit. There is no newly introduced method.

Programming Example of mSIEdit

  • SlEdit Example code:

  • We define use template of SIEdit in this way

  • Control window class: NCSCTRL_MLEDIT

  • Control English name: Multiline Edit or MlEdit

  • Brief introduction: Multiline text edit box

  • Schematic diagram:

alt

Style of mMIEdit

It is inherited from the style of mEdit.

Style name

miniStudio property name

Explanation

NCSS_MLEDIT_AUTOWRAP

AutoWrap->TRUE

Automatic wrap

Property of mMIEdit

It is inherited from the property of mEdit.

Property

miniStudio property name

Type

Authority

Explanation

NCSP_MLEDIT_LINECOUNT

--

int

RO

Row number

NCSP_MLEDIT_LINEHEIGHT

LineHeight

int

RW

Row height

NCSP_MLEDIT_LINEFEEDISPCHAR

--

char

WO

Line break is displayed by this character

NCSP_MLEDIT_LINESEP

LineSeperator

char

RW

Line break symbol, “\n” by default

NCSP_MLEDIT_CARETSHAPE

CaretShap

int

RW

Cursor shape ED_CARETSHAPE_LINE or ED_CARETSHAPE_BLOCK

NCSP_MLEDIT_NUMOFPARAGRAPHS

--

int

RO

Number of paragraphs

Event of mMIEdit

It is inherited from the event of mEdit. There is no newly introduced event.

Method of mMIEdit

It is inherited from the method of mEdit.

Programming Example of mMIEdit

  • MlEdit Example code:

  • We define the use template of MIEdit in this way


<< Property Sheet Control Class | Table of Contents | Animation Control Class >>

Last updated