fix find in popup window on type text
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2087 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
dc39460b7e
commit
93fb6372e6
@ -51,12 +51,12 @@ type
|
|||||||
FLookupDisplayIndex: integer;
|
FLookupDisplayIndex: integer;
|
||||||
FLookupDisplayField:string;
|
FLookupDisplayField:string;
|
||||||
procedure ClearFind;
|
procedure ClearFind;
|
||||||
procedure FindNextChar(UTF8Key: TUTF8Char);
|
procedure FindNextChar(var UTF8Key: TUTF8Char);
|
||||||
// procedure FindNextUTF8Char(UTF8Key: TUTF8Char);
|
// procedure FindNextUTF8Char(UTF8Key: TUTF8Char);
|
||||||
procedure FindPriorChar;
|
procedure FindPriorChar;
|
||||||
procedure SetLookupDisplayIndex(const AValue: integer);
|
procedure SetLookupDisplayIndex(const AValue: integer);
|
||||||
protected
|
protected
|
||||||
procedure KeyPress(var Key: char); override;
|
// procedure KeyPress(var Key: char); override;
|
||||||
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
|
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
|
||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
property LookupDisplayIndex:integer read FLookupDisplayIndex write SetLookupDisplayIndex;
|
property LookupDisplayIndex:integer read FLookupDisplayIndex write SetLookupDisplayIndex;
|
||||||
@ -810,48 +810,28 @@ begin
|
|||||||
DataSource.DataSet.First;
|
DataSource.DataSet.First;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPopUpGrid.FindNextChar(UTF8Key: TUTF8Char);
|
procedure TPopUpGrid.FindNextChar(var UTF8Key: TUTF8Char);
|
||||||
var
|
|
||||||
F:string;
|
|
||||||
begin
|
begin
|
||||||
|
if DatalinkActive then
|
||||||
|
begin
|
||||||
|
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine + UTF8Key, [loCaseInsensitive, loPartialKey]) then
|
||||||
|
begin
|
||||||
FFindLine:=FFindLine + UTF8Key;
|
FFindLine:=FFindLine + UTF8Key;
|
||||||
if DatalinkActive then
|
|
||||||
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
|
|
||||||
begin
|
|
||||||
TPopUpForm(Owner).WControl.Caption:=FFindLine;
|
TPopUpForm(Owner).WControl.Caption:=FFindLine;
|
||||||
TPopUpForm(Owner).WControl.Repaint;
|
TPopUpForm(Owner).WControl.Repaint;
|
||||||
end
|
end;
|
||||||
else
|
UTF8Key:='';
|
||||||
FFindLine:=F;
|
end;
|
||||||
end;
|
end;
|
||||||
{
|
|
||||||
procedure TPopUpGrid.FindNextUTF8Char(UTF8Key: TUTF8Char);
|
|
||||||
var
|
|
||||||
F:string;
|
|
||||||
begin
|
|
||||||
FFindLine:=FFindLine + AChar;
|
|
||||||
if DatalinkActive then
|
|
||||||
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
|
|
||||||
begin
|
|
||||||
TPopUpForm(Owner).WControl.Caption:=FFindLine;
|
|
||||||
TPopUpForm(Owner).WControl.Repaint;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FFindLine:=F;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
procedure TPopUpGrid.FindPriorChar;
|
procedure TPopUpGrid.FindPriorChar;
|
||||||
var
|
var
|
||||||
F:string;
|
F:string;
|
||||||
begin
|
begin
|
||||||
if FFindLine = '' then exit;
|
if (FFindLine = '') or (not DatalinkActive) then exit;
|
||||||
F:=FFindLine;
|
F:=FFindLine;
|
||||||
UTF8Delete(FFindLine, UTF8Length(FFindLine), 1);
|
UTF8Delete(FFindLine, UTF8Length(FFindLine), 1);
|
||||||
//Delete(FFindLine, Length(FFindLine), 1);
|
|
||||||
if DatalinkActive then
|
|
||||||
if (FFindLine<>'') then
|
if (FFindLine<>'') then
|
||||||
begin
|
|
||||||
if true then
|
|
||||||
begin
|
begin
|
||||||
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
|
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
|
||||||
begin
|
begin
|
||||||
@ -862,9 +842,6 @@ begin
|
|||||||
FFindLine:=F;
|
FFindLine:=F;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey])
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
TPopUpForm(Owner).WControl.Caption:=' ';
|
TPopUpForm(Owner).WControl.Caption:=' ';
|
||||||
TPopUpForm(Owner).WControl.Repaint;
|
TPopUpForm(Owner).WControl.Repaint;
|
||||||
@ -878,36 +855,20 @@ begin
|
|||||||
FLookupDisplayField:=Columns[FLookupDisplayIndex].FieldName;
|
FLookupDisplayField:=Columns[FLookupDisplayIndex].FieldName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPopUpGrid.KeyPress(var Key: char);
|
|
||||||
begin
|
|
||||||
inherited KeyPress(Key);
|
|
||||||
if (Columns[FLookupDisplayIndex].Field.DataType<>ftString) and not (Key in ['0'..'9']) then
|
|
||||||
Exit
|
|
||||||
else
|
|
||||||
if Key=#32 then
|
|
||||||
FindNextChar(Key)
|
|
||||||
else
|
|
||||||
if Key>#32 then
|
|
||||||
FindNextChar(Key)
|
|
||||||
else
|
|
||||||
if Key = #8 then
|
|
||||||
ClearFind;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPopUpGrid.UTF8KeyPress(var UTF8Key: TUTF8Char);
|
procedure TPopUpGrid.UTF8KeyPress(var UTF8Key: TUTF8Char);
|
||||||
begin
|
begin
|
||||||
inherited UTF8KeyPress(UTF8Key);
|
inherited UTF8KeyPress(UTF8Key);
|
||||||
{ if (Columns[FLookupDisplayIndex].Field.DataType<>ftString) and not (Key in ['0'..'9']) then
|
if UTF8Key>=#32 then
|
||||||
Exit
|
|
||||||
else}
|
|
||||||
if UTF8Key=#32 then
|
|
||||||
FindNextChar(UTF8Key)
|
FindNextChar(UTF8Key)
|
||||||
else
|
else
|
||||||
if UTF8Key>#32 then
|
if UTF8Key>#32 then
|
||||||
FindNextChar(UTF8Key)
|
FindNextChar(UTF8Key)
|
||||||
else
|
else
|
||||||
if UTF8Key = #8 then
|
if UTF8Key = #8 then
|
||||||
ClearFind;
|
ClearFind
|
||||||
|
else
|
||||||
|
exit;
|
||||||
|
UTF8Key:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPopUpGrid.KeyDown(var Key: Word; Shift: TShiftState);
|
procedure TPopUpGrid.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
|
Loading…
Reference in New Issue
Block a user