Support for listbox searching

This commit is contained in:
mysticbbs 2013-02-16 21:22:49 -05:00
parent 0d5ab646a0
commit 5427cc9043
1 changed files with 29 additions and 16 deletions

View File

@ -9,6 +9,17 @@ Uses
m_Input, m_Input,
m_Output; m_Output;
Const
BoxFrameType : Array[1..8] of String[8] =
('ÚÄ¿³³ÀÄÙ',
'ÉÍ»ººÈͼ',
'ÖÄ·ººÓĽ',
'Õ͸³³Ô;',
'ÛßÛÛÛÛÜÛ',
'ÛßÜÛÛßÜÛ',
' ',
'.-.||`-''');
Type Type
TMenuBox = Class TMenuBox = Class
Console : TOutput; Console : TOutput;
@ -126,16 +137,6 @@ Begin
End; End;
Procedure TMenuBox.Open (X1, Y1, X2, Y2: Byte); Procedure TMenuBox.Open (X1, Y1, X2, Y2: Byte);
Const
BF : Array[1..8] of String[8] =
('ÚÄżłłŔÄŮ',
'ÉÍťşşČÍź',
'ÖġşşÓÄ˝',
'Ő͸łłÔÍž',
'ŰßŰŰŰŰÜŰ',
'ŰßÜŰŰßÜŰ',
' ',
'.-.||`-''');
Var Var
A : Integer; A : Integer;
B : Integer; B : Integer;
@ -157,16 +158,16 @@ Begin
BoxAttr4 := BoxAttr; BoxAttr4 := BoxAttr;
End; End;
Console.WriteXY (X1, Y1, BoxAttr, BF[FrameType][1] + strRep(BF[FrameType][2], B)); Console.WriteXY (X1, Y1, BoxAttr, BoxFrameType[FrameType][1] + strRep(BoxFrameType[FrameType][2], B));
Console.WriteXY (X2, Y1, BoxAttr4, BF[FrameType][3]); Console.WriteXY (X2, Y1, BoxAttr4, BoxFrameType[FrameType][3]);
For A := Y1 + 1 To Y2 - 1 Do Begin For A := Y1 + 1 To Y2 - 1 Do Begin
Console.WriteXY (X1, A, BoxAttr, BF[FrameType][4] + strRep(' ', B)); Console.WriteXY (X1, A, BoxAttr, BoxFrameType[FrameType][4] + strRep(' ', B));
Console.WriteXY (X2, A, BoxAttr2, BF[FrameType][5]); Console.WriteXY (X2, A, BoxAttr2, BoxFrameType[FrameType][5]);
End; End;
Console.WriteXY (X1, Y2, BoxAttr3, BF[FrameType][6]); Console.WriteXY (X1, Y2, BoxAttr3, BoxFrameType[FrameType][6]);
Console.WriteXY (X1+1, Y2, BoxAttr2, strRep(BF[FrameType][7], B) + BF[FrameType][8]); Console.WriteXY (X1+1, Y2, BoxAttr2, strRep(BoxFrameType[FrameType][7], B) + BoxFrameType[FrameType][8]);
If Header <> '' Then If Header <> '' Then
Case HeadType of Case HeadType of
@ -491,6 +492,12 @@ Begin
End; End;
Else Else
If Pos(Ch, HiChars) > 0 Then Begin If Pos(Ch, HiChars) > 0 Then Begin
If SearchStr <> '' Then Begin
SearchStr := '';
If Assigned(SearchProc) Then
SearchProc(Self, SearchStr);
End;
ExitCode := Ch; ExitCode := Ch;
Exit; Exit;
End; End;
@ -509,6 +516,12 @@ Begin
DownArrow; DownArrow;
End Else End Else
If Pos(Ch, LoChars) > 0 Then Begin If Pos(Ch, LoChars) > 0 Then Begin
If SearchStr <> '' Then Begin
SearchStr := '';
If Assigned(SearchProc) Then
SearchProc(Self, SearchStr);
End;
ExitCode := Ch; ExitCode := Ch;
Exit; Exit;
End Else Begin End Else Begin