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]; NumericDataTypes = IntegerDataTypes + [ftFloat, ftCurrency, ftBCD];
const DataTimeTypes = [ftTime, ftDateTime, ftTimeStamp];
TimeDataTypes = [ftTime, ftDateTime, ftTimeStamp];
StringTypes = [ftString, {ftMemo,} ftFixedChar, ftWideString, ftFixedWideChar, ftWideMemo];
type type

View File

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

View File

@ -823,11 +823,30 @@ begin
end; end;
procedure TPopUpGrid.FindNextChar(var UTF8Key: TUTF8Char); procedure TPopUpGrid.FindNextChar(var UTF8Key: TUTF8Char);
var
F:TField;
V:boolean;
begin begin
if DatalinkActive then if DatalinkActive then
begin 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 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; FFindLine:=FFindLine + UTF8Key;
TPopUpForm(Owner).WControl.Caption:=FFindLine; TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint; TPopUpForm(Owner).WControl.Repaint;
@ -847,11 +866,16 @@ begin
begin begin
if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then if DataSetLocateThrough(DataSource.DataSet, FLookupDisplayField, FFindLine, [loCaseInsensitive, loPartialKey]) then
begin begin
TPopUpForm(Owner).WControl.Caption:=FFindLine; // TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint; // TPopUpForm(Owner).WControl.Repaint;
end end;
else // else
FFindLine:=F; // FFindLine:=F;
//FFindLine:=FFindLine + UTF8Key;
TPopUpForm(Owner).WControl.Caption:=FFindLine;
TPopUpForm(Owner).WControl.Repaint;
end end
else else
begin begin