--- ibx/trunk/ibcontrols/IBLookupComboEditBox.pas 2019/01/18 13:35:28 271 +++ ibx/trunk/ibcontrols/IBLookupComboEditBox.pas 2019/02/04 13:34:37 272 @@ -54,7 +54,9 @@ type FOwner: TIBLookupComboEditBox; protected procedure ActiveChanged; override; + {$if lcl_fullversion < 2000003} procedure DataEvent(Event: TDataEvent; Info: Ptrint); override; + {$endif} procedure RecordChanged(Field: TField); override; procedure UpdateData; override; public @@ -129,7 +131,6 @@ type procedure Loaded; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure SetItemIndex(const Val: integer); override; - function SQLSafe(aText: string): string; procedure UpdateShowing; override; procedure UpdateData(Sender: TObject); override; public @@ -155,7 +156,7 @@ type implementation -uses Variants, LCLProc, LazUTF8; +uses Variants, LCLProc, LazUTF8, IBUtils; { TIBLookupControlLink } @@ -177,12 +178,14 @@ begin FOwner.ActiveChanged(self) end; +{$if lcl_fullversion < 2000003} procedure TIBLookupComboDataLink.DataEvent(Event: TDataEvent; Info: Ptrint); begin inherited DataEvent(Event, Info); if Event = deLayoutChange then FOwner.LookupCache := FOwner.LookupCache; {sneaky way of calling UpdateLookup} end; +{$endif} procedure TIBLookupComboDataLink.RecordChanged(Field: TField); begin @@ -392,10 +395,10 @@ begin FilterText := Text; if cbactSearchCaseSensitive in AutoCompleteText then Parser.Add2WhereClause(GetRelationNameQualifier + '"' + ListField + '" Like ''' + - SQLSafe(FilterText) + '%''') + SQLSafeString(FilterText) + '%''') else Parser.Add2WhereClause('Upper(' + GetRelationNameQualifier + '"' + ListField + '") Like Upper(''' + - SQLSafe(FilterText) + '%'')'); + SQLSafeString(FilterText) + '%'')'); if cbactSearchAscending in AutoCompleteText then begin @@ -560,17 +563,6 @@ begin FLastKeyValue := KeyValue; end; -function TIBLookupComboEditBox.SQLSafe(aText: string): string; -var I: integer; -begin - Result := ''; - for I := 1 to length(aText) do - if aText[I] = '''' then - Result := Result + '''''' - else - Result := Result + aText[I]; -end; - procedure TIBLookupComboEditBox.UpdateShowing; begin inherited UpdateShowing; @@ -605,19 +597,24 @@ end; procedure TIBLookupComboEditBox.Change; begin - THackedCustomComboBox(self).CallChange; + if IsUnbound then + THackedCustomComboBox(self).CallChange + else + inherited Change; end; procedure TIBLookupComboEditBox.CloseUp; begin - inherited CloseUp; inherited DoEdit; + inherited CloseUp; + EditingDone; end; procedure TIBLookupComboEditBox.Select; begin inherited Select; - inherited DoEdit; + if IsUnbound then + inherited DoEdit; end; function TIBLookupComboEditBox.DoEdit: boolean;