Inkey now accepts timer
This commit is contained in:
parent
ed9529c818
commit
3078f804bf
|
@ -89,7 +89,7 @@ Type
|
||||||
Function DrawPercent (Bar : RecPercent; Part, Whole : SmallInt; Var Percent : SmallInt) : String;
|
Function DrawPercent (Bar : RecPercent; Part, Whole : SmallInt; Var Percent : SmallInt) : String;
|
||||||
Function GetInput (Field, Max, Mode: Byte; Default : String) : String;
|
Function GetInput (Field, Max, Mode: Byte; Default : String) : String;
|
||||||
Function InXY (X, Y, Field, Max, Mode: Byte; Default: String) : String;
|
Function InXY (X, Y, Field, Max, Mode: Byte; Default: String) : String;
|
||||||
Function InKey : Char;
|
Function InKey (Wait: LongInt) : Char;
|
||||||
Function GetYNL (Str: String; Yes: Boolean) : Boolean;
|
Function GetYNL (Str: String; Yes: Boolean) : Boolean;
|
||||||
Function GetKey : Char;
|
Function GetKey : Char;
|
||||||
Function GetYN (Str: String; Yes: Boolean) : Boolean;
|
Function GetYN (Str: String; Yes: Boolean) : Boolean;
|
||||||
|
@ -1091,12 +1091,12 @@ Begin
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
Function TBBSIO.InKey : Char;
|
Function TBBSIO.InKey (Wait: LongInt) : Char;
|
||||||
Begin
|
Begin
|
||||||
Result := #255;
|
Result := #255;
|
||||||
IsArrow := False;
|
IsArrow := False;
|
||||||
|
|
||||||
If Input.KeyWait(1000) Then Begin
|
If Input.KeyWait(Wait) Then Begin
|
||||||
Result := Input.ReadKey;
|
Result := Input.ReadKey;
|
||||||
LocalInput := True;
|
LocalInput := True;
|
||||||
|
|
||||||
|
@ -1115,7 +1115,7 @@ End;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
Function TBBSIO.InKey : Char;
|
Function TBBSIO.InKey (Wait: LongInt) : Char;
|
||||||
Var
|
Var
|
||||||
Handles : Array[0..1] of THandle;
|
Handles : Array[0..1] of THandle;
|
||||||
InType : Byte;
|
InType : Byte;
|
||||||
|
@ -1130,14 +1130,14 @@ Begin
|
||||||
WSAResetEvent (Handles[1]);
|
WSAResetEvent (Handles[1]);
|
||||||
WSAEventSelect (TBBSCore(Core).Client.FSocketHandle, Handles[1], FD_READ OR FD_CLOSE);
|
WSAEventSelect (TBBSCore(Core).Client.FSocketHandle, Handles[1], FD_READ OR FD_CLOSE);
|
||||||
|
|
||||||
Case WaitForMultipleObjects(2, @Handles, False, 1000) of
|
Case WaitForMultipleObjects(2, @Handles, False, Wait) of
|
||||||
WAIT_OBJECT_0 : InType := 1;
|
WAIT_OBJECT_0 : InType := 1;
|
||||||
WAIT_OBJECT_0 + 1 : InType := 2;
|
WAIT_OBJECT_0 + 1 : InType := 2;
|
||||||
Else
|
Else
|
||||||
Exit;
|
Exit;
|
||||||
End;
|
End;
|
||||||
End Else
|
End Else
|
||||||
Case WaitForSingleObject (Handles[0], 1000) of
|
Case WaitForSingleObject (Handles[0], Wait) of
|
||||||
WAIT_OBJECT_0 : InType := 1;
|
WAIT_OBJECT_0 : InType := 1;
|
||||||
Else
|
Else
|
||||||
Exit;
|
Exit;
|
||||||
|
@ -1296,7 +1296,7 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Result := InKey;
|
Result := InKey(1000);
|
||||||
Until Result <> #255;
|
Until Result <> #255;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
@ -1738,7 +1738,10 @@ End;
|
||||||
Function TBBSIO.DrawPercent (Bar: RecPercent; Part, Whole: SmallInt; Var Percent : SmallInt) : String;
|
Function TBBSIO.DrawPercent (Bar: RecPercent; Part, Whole: SmallInt; Var Percent : SmallInt) : String;
|
||||||
Var
|
Var
|
||||||
FillSize : Byte;
|
FillSize : Byte;
|
||||||
|
Attr : Byte;
|
||||||
Begin
|
Begin
|
||||||
|
Attr := Screen.TextAttr;
|
||||||
|
|
||||||
Screen.TextAttr := 0; // kludge to force it to return full ansi codes
|
Screen.TextAttr := 0; // kludge to force it to return full ansi codes
|
||||||
|
|
||||||
If (Part = 0) or (Whole = 0) or (Part > Whole) Then Begin
|
If (Part = 0) or (Whole = 0) or (Part > Whole) Then Begin
|
||||||
|
@ -1754,7 +1757,7 @@ Begin
|
||||||
|
|
||||||
Result := Attr2Ansi(Bar.HiAttr) + strRep(Bar.HiChar, FillSize) +
|
Result := Attr2Ansi(Bar.HiAttr) + strRep(Bar.HiChar, FillSize) +
|
||||||
Attr2Ansi(Bar.LoAttr) + strRep(Bar.LoChar, Bar.BarLength - FillSize) +
|
Attr2Ansi(Bar.LoAttr) + strRep(Bar.LoChar, Bar.BarLength - FillSize) +
|
||||||
Attr2Ansi(7);
|
Attr2Ansi(Attr);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
|
|
Loading…
Reference in New Issue