Reworked standard menu input
This commit is contained in:
parent
e740571ada
commit
66283928f5
|
@ -37,6 +37,7 @@ Type
|
||||||
Function ExecuteCommandList (Num, JumpID: LongInt) : Byte;
|
Function ExecuteCommandList (Num, JumpID: LongInt) : Byte;
|
||||||
Function ExecuteByHotkey (Key: String; Interval: LongInt) : Byte;
|
Function ExecuteByHotkey (Key: String; Interval: LongInt) : Byte;
|
||||||
Function ExecuteCommand (Cmd, CmdData: String) : Boolean;
|
Function ExecuteCommand (Cmd, CmdData: String) : Boolean;
|
||||||
|
Function SpecialKey (Str: String) : Boolean;
|
||||||
Function ShowMenu : Boolean;
|
Function ShowMenu : Boolean;
|
||||||
Procedure GenerateMenu;
|
Procedure GenerateMenu;
|
||||||
Procedure DoStandardMenu;
|
Procedure DoStandardMenu;
|
||||||
|
@ -403,6 +404,16 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function TMenuEngine.SpecialKey (Str: String) : Boolean;
|
||||||
|
Begin
|
||||||
|
Result :=
|
||||||
|
(Str = 'AFTER') or
|
||||||
|
(Str = 'EVERY') or
|
||||||
|
(Str = 'FIRSTCMD') or
|
||||||
|
(Str = 'LINEFEED') or
|
||||||
|
(Str = 'TIMER');
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure TMenuEngine.GenerateMenu;
|
Procedure TMenuEngine.GenerateMenu;
|
||||||
Var
|
Var
|
||||||
Format : Byte;
|
Format : Byte;
|
||||||
|
@ -469,10 +480,11 @@ End;
|
||||||
|
|
||||||
Procedure TMenuEngine.DoStandardMenu;
|
Procedure TMenuEngine.DoStandardMenu;
|
||||||
Var
|
Var
|
||||||
Ch : Char;
|
Ch : Char;
|
||||||
Temp : String[mysMaxMenuInput];
|
Temp : String[mysMaxMenuInput];
|
||||||
Count : LongInt;
|
Count : LongInt;
|
||||||
Found : Boolean;
|
Found : Boolean;
|
||||||
|
ValidKey : Boolean;
|
||||||
|
|
||||||
Procedure Translate;
|
Procedure Translate;
|
||||||
Begin
|
Begin
|
||||||
|
@ -553,21 +565,26 @@ Begin
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If UseHotKeys Then Begin
|
If UseHotKeys Then Begin
|
||||||
Count := 0;
|
ValidKey := False;
|
||||||
|
Found := False;
|
||||||
|
Count := 0;
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Inc (Count);
|
Inc (Count);
|
||||||
|
|
||||||
|
If SpecialKey(Data.Item[Count]^.HotKey) Then Continue;
|
||||||
|
|
||||||
Found := Data.Item[Count]^.HotKey = Temp + UpCase(Ch);
|
Found := Data.Item[Count]^.HotKey = Temp + UpCase(Ch);
|
||||||
|
|
||||||
|
If Not ValidKey Then
|
||||||
|
ValidKey := Temp + UpCase(Ch) = Copy(Data.Item[Count]^.HotKey, 1, Length(Temp + Ch));
|
||||||
Until Found or (Count >= Data.NumItems);
|
Until Found or (Count >= Data.NumItems);
|
||||||
|
|
||||||
If Found And (TBBSCore(Owner).User.Access(Data.Item[Count]^.Access)) Then Begin
|
If Found And (TBBSCore(Owner).User.Access(Data.Item[Count]^.Access)) Then Begin
|
||||||
AddChar;
|
AddChar;
|
||||||
Break;
|
Break;
|
||||||
End Else
|
End Else
|
||||||
If UseLongKey Then
|
If ValidKey Then AddChar;
|
||||||
If ((Temp[1] = '/') And (Temp[0] > #0)) or ((Temp[0] = #0) And (Ch = '/')) Then
|
|
||||||
AddChar;
|
|
||||||
End Else
|
End Else
|
||||||
AddChar;
|
AddChar;
|
||||||
End;
|
End;
|
||||||
|
@ -852,6 +869,8 @@ Begin
|
||||||
Repeat
|
Repeat
|
||||||
Inc (Count);
|
Inc (Count);
|
||||||
|
|
||||||
|
If SpecialKey(Data.Item[Count]^.HotKey) Then Continue;
|
||||||
|
|
||||||
Found := Data.Item[Count]^.HotKey = TempStr + UpCase(Ch);
|
Found := Data.Item[Count]^.HotKey = TempStr + UpCase(Ch);
|
||||||
|
|
||||||
If Not ValidKey Then
|
If Not ValidKey Then
|
||||||
|
|
Loading…
Reference in New Issue