Syntax
short SetKeyinputMode(
short mode
);
Parameters
- mode
-
[in] Set the shift control mode.
Value Description ORIGINAL_SHIFT_MODE The key is confirmed as soon as you press the key. ALTERNATE_SHIFT_MODE Input character candidates are displayed, and when the time specified by the SetKeyinputTimer function elapses, the input character is confirmed. Press the [0][1][2][3][4][5][6][7][8][9][.] key while the input candidate character is displayed to confirm the input character and The input candidate characters of the pressed key are displayed in the next column.
If you press the [SHIFT] key while the input candidate character is displayed, the input character is canceled.
*This parameter is legacy. When creating new software, please use ALTERNATE_SHIFT_MODE2.ALTERNATE_SHIFT_MODE2 Displays the input candidate character and confirms the input character when the time specified by SetKeyinputTimer function elapses.
Press the [0][1][2][3][4][5][6][7][8][9][.] key while the input candidate character is displayed to confirm the input character and The input candidate characters of the pressed key are displayed in the next column.
Press the [SCAN][Q1][Q2][CLR][SHIFT][ENT][BS][F1][F2][F3] keys while the input candidate characters are displayed to confirm the input characters.
MANUAL_SHIFT_MODE Disable the control of the shift state by the OS. CURRENT_MODE Returns the current shift control mode.
Return value
Returns the shift control mode after the change.
Remarks
If you set MANUAL_SHIFT_MODE, you will receive the SHIFT_KEY key code when you press the [SHIFT] key. See Key code for key code details.Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
#define TIME_UNIT 500
#define SHOW_TIME_MIN 0
#define SHOW_TIME_MAX 5
#define CURSOR_COLOR RGB_GREEN
extern void PrintChar(unsigned char);
extern void PrintSymbol(unsigned int);
static const char *shifttime[] =
{
"KINPUT_CHECK_MIN",
"1000 ",
"1500 ",
"KINPUT_CHECK_MAX",
};
static const char *shiftmode[] =
{
"ORIGINAL_SHIFT_MODE ",
"ALTERNATE_SHIFT_MODE2"
};
static unsigned short input_time;
static unsigned short output_time;
static void TimePrint(void)
{
GotoXY(1, 4);
printf(" ");
GotoXY(1, 4);
printf("%s\r\n", shifttime[input_time]);
SetKeyinputTimer((input_time + 1) * TIME_UNIT);
GotoXY(1, 5);
printf(" ");
GotoXY(1, 5);
output_time = SetKeyinputTimer(1);
printf("INPUT TIME = %d\r\n", output_time);
}
void main(void)
{
char c;
unsigned char exit_flg;
unsigned char mode_flg;
int i;
unsigned long save_bcolor;
GotoXY(1, 1);
printf("SHIFT Mode\r\n");
i = 1;
exit_flg = 0;
mode_flg = ALTERNATE_SHIFT_MODE2;
SetKeyinputMode(mode_flg);
input_time = 0;
SetKeyinputTimer(input_time * TIME_UNIT);
GotoXY(1, 3);
printf("%s", shiftmode[mode_flg]);
GotoXY(1, 4);
TimePrint();
GotoXY(1, 5);
output_time = SetKeyinputTimer(1);
printf("INPUT TIME = %d\r\n", output_time);
save_bcolor = SetBackColor(-1L);
SetBackColor(CURSOR_COLOR);
GotoXY(i, 7);
PrintSymbol('_');
while(1)
{
if (kbhit())
{
c = getchar();
switch(c)
{
case BS_KEY:
exit_flg = 1;
break;
case F1_KEY:
case SHIFT_F1_KEY:
SetBackColor(save_bcolor);
GotoXY(1, 3);
printf(" ");
if (mode_flg == ALTERNATE_SHIFT_MODE2)
{
mode_flg = ORIGINAL_SHIFT_MODE;
}
else
{
mode_flg = ALTERNATE_SHIFT_MODE2;
}
GotoXY(1, 3);
printf("%s", shiftmode[mode_flg]);
SetKeyinputMode(mode_flg);
SetBackColor(CURSOR_COLOR);
GotoXY(i, 7);
PrintSymbol('_');
break;
case F2_KEY:
case SHIFT_F2_KEY:
SetBackColor(save_bcolor);
if (input_time == SHOW_TIME_MAX)
{
input_time = SHOW_TIME_MIN;
}
else
{
input_time++;
}
TimePrint();
SetBackColor(CURSOR_COLOR);
GotoXY(i, 7);
PrintSymbol('_');
break;
case F3_KEY:
case SHIFT_F3_KEY:
SetBackColor(save_bcolor);
if (input_time == SHOW_TIME_MIN)
{
input_time = SHOW_TIME_MAX;
}
else
{
input_time--;
}
TimePrint();
SetBackColor(CURSOR_COLOR);
GotoXY(i, 7);
PrintSymbol('_');
break;
default:
GotoXY(i, 7);
if (c >= 0x20 && c < 0x80)
{
SetBackColor(save_bcolor);
PrintSymbol(c);
i++;
if (i == 10) i = 1;
SetBackColor(CURSOR_COLOR);
GotoXY(i, 7);
PrintSymbol('_');
}
break;
}
}
if (exit_flg == 1) break;
Idle();
}
GotoXY(1, 9);
printf("Test Done!!\r\n");
while(1)
{
Idle();
}
}
Last updated: 2022/08/05