key getch if key switch key case ESC pos_g break case ENTER select bre

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
key=getch();
if(key!=0)
{
switch(key)
{
case ESC:
pos_g=1;
break;
case ENTER:
select();
break;
case TAB:
pos_x=0;
pos_g=1;
n!=0?view():ERRORS("List is empty");
pos_x=1;
break;
default :
break;
}
}
else
{
key=getch();
if(pos_g==1)
{
switch(key)
{
case RIGHT:
if(pos_x<7)
pos_x++;
break;
case LEFT:
if(pos_x>1)
pos_x--;
break;
default :
break;
}
}
if(pos_g==0)
{
switch(key)
{
case UP:
if(pos_y>1)
pos_y--;
break;
case DOWN:
if(pos_y<3)
pos_y++;
break;
default :
break;
}
}
F(key);
}