fix error in lockup box

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2397 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75 2012-04-21 06:11:08 +00:00
parent 221bc57670
commit 2983ae02f7
3 changed files with 35 additions and 10 deletions

View File

@ -43,8 +43,9 @@ const
NumericDataTypes = IntegerDataTypes + [ftFloat, ftCurrency, ftBCD];
const
TimeDataTypes = [ftTime, ftDateTime, ftTimeStamp];
DataTimeTypes = [ftTime, ftDateTime, ftTimeStamp];
StringTypes = [ftString, {ftMemo,} ftFixedChar, ftWideString, ftFixedWideChar, ftWideMemo];
type

View File

@ -146,7 +146,7 @@ type
procedure TCustomRxDBTimeEdit.DataChange(Sender: TObject);
begin
if Assigned(FDataLink.Field) and (FDataLink.Field.DataType in TimeDataTypes) then
if Assigned(FDataLink.Field) and (FDataLink.Field.DataType in DataTimeTypes) then
Self.Time:=FDatalink.Field.AsDateTime
else
Text := '';
@ -190,7 +190,7 @@ end;
procedure TCustomRxDBTimeEdit.UpdateData(Sender: TObject);
begin
if Assigned(FDataLink.Field) and (FDataLink.Field.DataType in TimeDataTypes) then
if Assigned(FDataLink.Field) and (FDataLink.Field.DataType in DataTimeTypes) then
begin
FDataLink.Field.AsDateTime := Self.Time;
end;

View File

@ -823,11 +823,30 @@ begin
end;
procedure TPopUpGrid.FindNextChar(var UTF8Key: TUTF8Char);
var
F:TField;
V:boolean;
begin
if DatalinkActive then
begin
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine + UTF8Key, [loCaseInsensitive, loPartialKey]) then
F:=Columns[FLookupDisplayIndex].Field;
if F.DataType in StringTypes then
V:=true
else
begin
if Length(UTF8Key) = 1 then
V:=F.IsValidChar(UTF8Key[1])
else
V:=false;
end;
if V then
begin
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine + UTF8Key, [loCaseInsensitive, loPartialKey]) then
begin
// TPopUpForm(Owner).WControl.Caption:=FFindLine;
// TPopUpForm(Owner).WControl.Repaint;
end;
FFindLine:=FFindLine + UTF8Key;
TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint;
@ -847,11 +866,16 @@ begin
begin
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
begin
TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint;
end
else
FFindLine:=F;
// TPopUpForm(Owner).WControl.Caption:=FFindLine;
// TPopUpForm(Owner).WControl.Repaint;
end;
// else
// FFindLine:=F;
//FFindLine:=FFindLine + UTF8Key;
TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint;
end
else
begin