Represents a buffer that stores key input data and information for controlling key input.

Syntax

typedef struct _AM_EditParam{
  int MaxDigits;
  int CursorForeColor;
  int CursorBackColor;
  int ShiftModeForeColor;
  int ShiftModeBackColor;
  int EditOption;
  pAM_ShiftCandidateTable alphaCandidateTable;
  char *Value;
  int ValueBufSize;
} AM_EditParam, *pAM_EditParam;

Members

MaxDigits
Maximum number of digits:
Specify the maximum number of characters that can be entered in the input field.
CursorForeColor
Cursor text color:
When the cursor is lit in the input field, if the original color of the pixel where the cursor is displayed is the text color, it is rewritten to the cursor text color.
To turn off the cursor in the input field, reversely rewrite the pixel from the cursor text colot to original text color.
CursorBackColor
Cursor background color:
When the cursor is lit in the input field, if the original color of the pixel where the cursor is displayed is the background color, it is rewritten to the cursor bakground color.
To turn off the cursor in the input field, reversely rewrite the pixel from the cursor background colot to original background color.

Note:

Do not set the same color for the cursor text color and the cursor background color.
ShiftModeForeColor
Text color of undetermined characters:
Specifies the text color of undetermined characters displayed in the input field in English mode or HEX mode.
ShiftModeBackColor
Background color of undetermined characters:
Specifies the background color of undetermined characters displayed in the input field in English mode or HEX mode.
EditOption
Edit options:
Specify various options that specify the operation of edit mode with the logical sum of the following flag values.
ValueDescription
AM_EDIT_ALLOW_HEX Allowed to switch to HEX mode by [SHIFT] key at non numeric field.
AM_EDIT_CLEAR_ON_FIRST_CHAR Clear text buffer on the first input.
AM_EDIT_DISABLE_TEXT_EDIT Disables input / edit operations. This field does not accept input / edit key operations even if it has focus. Use the AM_EnableTextEdit function to enable input operations.
(Ver. 1.6.1 or later)
AM_EDIT_DISALLOW_ALPHA Disallowed to switch to Lowercase English mode by [SHIFT] key at non numeric field.
AM_EDIT_DISALLOW_ALPHA_CAPS Disallowed to switch to Uppercase English mode by [SHIFT] key at non numeric field.
AM_EDIT_MOVE_CURSOR_BY_Q1Q2 If AM_EDIT_RIGHT and AM_EDIT_NUMERIC are not set, pressing the [Q1] and [Q2] keys will move the cursor left or right in the input field.
Also, regardless of AM_EDIT_RIGHT and AM_EDIT_NUMERIC, the focus does not move to another field when the [Q1] and [Q2] keys are pressed.
AM_EDIT_NO_CURSOR No cursor is displayed.
AM_EDIT_NO_PERIOD Ignore period input at non numeric field. (Period is ingnored always at numeric field.)
AM_EDIT_NUMERIC Numeric field. ([SHIFT] key is ignored).
AM_EDIT_NUMERIC_RIGHT Right aligned numeric field without cursor.
(AM_EDIT_RIGHT|AM_EDIT_NUMERIC|
AM_EDIT_NO_CURSOR)
AM_EDIT_PASSWORD Display asterisk. (only valid with non numeric field)
AM_EDIT_RIGHT Right aligned. (only valid with AM_EDIT_NUMERIC field)
AM_EDIT_SET_ALPHA Set initial shift mode to Lowercase English mode.
AM_EDIT_SET_ALPHA_CAPS Set initial shift mode to Uppercase English mode.
AM_EDIT_SET_HEX Set initial shift mode to HEX mode.
AM_EDIT_SET_NUMERIC Set initial shift mode to numeric mode.
AM_EDIT_UNDERLINE Show underline.
AM_EDIT_USE_CLEAR Clear text when [CLEAR] key is pressed.

alphaCandidateTable
Candidate character table:
You can specify the AM_ShiftCandidateTable structure to change the candidate characters displayed when inputting in English mode.
If you want to use the default candidate characters without changing them, set NULL
Value
Input buffer:
A pointer to the buffer that stores the key input data.
ValueBufSize
Input buffer size:
Size of the buffer that is pointed by Value

Remarks

To define a menu item for text entry with the AM_MenuItem structure, specify a pointer to this AM_EditParam structure in menuText and set AM_TEXT_EDIT to showControl.

The input data is stored in the input buffer as a NUL-terminated string. Therefore, the size of the input buffer (=ValueBufSize) set in Value must be greater than or equal to MaxDigits + 1.

Sample
static char nameBuf[8+1] = {""};

static const AM_EditParam EditParamName = {
    8,                  // MaxDigits
    RGB_WHITE,          // Cursor foregraund Color
    RGB_BLUE,           // Cursor backgraund Color
    RGB_WHITE,          // Shift mode foregraund Color
    RGB_BLUE,           // Shift mode backgraund Color
    AM_EDIT_SET_ALPHA | AM_EDIT_MOVE_CURSOR_BY_Q1Q2, // EditOption
    NULL,               // alphaCandidateTable
    nameBuf,            // Value
    sizeof(nameBuf)     // ValueBufSize
};

static const AM_MenuItem menu_EditName[] = {
  //id, y,x,   menuText,                ColorIdx, visible, enabled, selectable, showControl
  { 1,  2,1,   (void *)&EditParamName,  1,        true,    true,    true,       AM_TEXT_EDIT },
  { 0,  5,1,   "",                      0,        true,    true,    false,      AM_SHIFT_MODE },
  { 0,  5,7,   "",                      0,        true,    true,    false,      AM_SHIFT_CANDIDATE },
  { -1 }
};


To concatenate multiple lines of input fields into one input field, define AM_EditParam structures for the number of lines and specify the number of characters to display on that line with MaxDigits of each structure. Make sure the total number of characters matches the maximum number of characters in the input field. Members other than MaxDigits are not referenced in the structure on and after the second line, so it is not necessary to set them.
Specify the AM_EditParam structure defined in this way in the AM_MenuItem structure of each row with itemOption.

Sample
static char SsidBuf[32+1] = {""};

static const AM_EditParam EditParamSsid1 = {
    20,                 // MaxDigits
    RGB_YELLOW+1,       // Cursor foregraund Color
    RGB_YELLOW,         // Cursor backgraund Color
    RGB_BLACK,          // Shift mode foregraund Color
    RGB_YELLOW,         // Shift mode backgraund Color
    AM_EDIT_MOVE_CURSOR_BY_Q1Q2 | AM_EDIT_SET_NUMERIC, // EditOption
    NULL,               // alphaCandidateTable
    SsidBuf,            // Value
    sizeof(SsidBuf)     // ValueBufSize
};

static const AM_EditParam EditParamSsid2 = {
    12                  // MaxDigits
};

static const AM_MenuItem menu_WlanEditSsid[] = {
  //id, y,x,   menuText,                ColorIdx, visible, enabled, selectable, showControl,    checked, font, itemOption
  { 1,  2,1,   (void *)&EditParamSsid1, 1,        true,    true,    true,       AM_TEXT_EDIT,   false,   0,    AM_MULTI_START },
  { 0,  3,1,   (void *)&EditParamSsid2, 1,        true,    true,    true,       AM_TEXT_EDIT,   false,   0,    AM_MULTI_END },
  { 0,  5,1,   "",                      0,        true,    true,    false,      AM_SHIFT_MODE },
  { 0,  5,7,   "",                      0,        true,    true,    false,      AM_SHIFT_CANDIDATE },
  { -1 }
};

Requirements

Header file:
lib.h
AdvancedMenu.h

See also

Last updated: 2021/07/03