54 |
|
FOwner: TIBLookupComboEditBox; |
55 |
|
protected |
56 |
|
procedure ActiveChanged; override; |
57 |
+ |
{$if lcl_fullversion < 2000003} |
58 |
|
procedure DataEvent(Event: TDataEvent; Info: Ptrint); override; |
59 |
+ |
{$endif} |
60 |
|
procedure RecordChanged(Field: TField); override; |
61 |
|
procedure UpdateData; override; |
62 |
|
public |
119 |
|
procedure CheckAndInsert; |
120 |
|
procedure DoEnter; override; |
121 |
|
procedure DoExit; override; |
122 |
< |
{$if lcl_fullversion >= 2000000} |
122 |
> |
{$if lcl_fullversion >= 2000003} |
123 |
|
{Deferred update changes in Lazarus 2.0 stop the combo box working when |
124 |
|
the datasource is nil. We thus have to reverse out the changes :(} |
125 |
|
function DoEdit: boolean; override; |
131 |
|
procedure Loaded; override; |
132 |
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
133 |
|
procedure SetItemIndex(const Val: integer); override; |
132 |
– |
function SQLSafe(aText: string): string; |
134 |
|
procedure UpdateShowing; override; |
135 |
|
procedure UpdateData(Sender: TObject); override; |
136 |
|
public |
156 |
|
|
157 |
|
implementation |
158 |
|
|
159 |
< |
uses Variants, LCLProc, LazUTF8; |
159 |
> |
uses Variants, LCLProc, LazUTF8, IBUtils; |
160 |
|
|
161 |
|
{ TIBLookupControlLink } |
162 |
|
|
178 |
|
FOwner.ActiveChanged(self) |
179 |
|
end; |
180 |
|
|
181 |
+ |
{$if lcl_fullversion < 2000003} |
182 |
|
procedure TIBLookupComboDataLink.DataEvent(Event: TDataEvent; Info: Ptrint); |
183 |
|
begin |
184 |
|
inherited DataEvent(Event, Info); |
185 |
|
if Event = deLayoutChange then |
186 |
|
FOwner.LookupCache := FOwner.LookupCache; {sneaky way of calling UpdateLookup} |
187 |
|
end; |
188 |
+ |
{$endif} |
189 |
|
|
190 |
|
procedure TIBLookupComboDataLink.RecordChanged(Field: TField); |
191 |
|
begin |
395 |
|
FilterText := Text; |
396 |
|
if cbactSearchCaseSensitive in AutoCompleteText then |
397 |
|
Parser.Add2WhereClause(GetRelationNameQualifier + '"' + ListField + '" Like ''' + |
398 |
< |
SQLSafe(FilterText) + '%''') |
398 |
> |
SQLSafeString(FilterText) + '%''') |
399 |
|
else |
400 |
|
Parser.Add2WhereClause('Upper(' + GetRelationNameQualifier + '"' + ListField + '") Like Upper(''' + |
401 |
< |
SQLSafe(FilterText) + '%'')'); |
401 |
> |
SQLSafeString(FilterText) + '%'')'); |
402 |
|
|
403 |
|
if cbactSearchAscending in AutoCompleteText then |
404 |
|
begin |
563 |
|
FLastKeyValue := KeyValue; |
564 |
|
end; |
565 |
|
|
563 |
– |
function TIBLookupComboEditBox.SQLSafe(aText: string): string; |
564 |
– |
var I: integer; |
565 |
– |
begin |
566 |
– |
Result := ''; |
567 |
– |
for I := 1 to length(aText) do |
568 |
– |
if aText[I] = '''' then |
569 |
– |
Result := Result + '''''' |
570 |
– |
else |
571 |
– |
Result := Result + aText[I]; |
572 |
– |
end; |
573 |
– |
|
566 |
|
procedure TIBLookupComboEditBox.UpdateShowing; |
567 |
|
begin |
568 |
|
inherited UpdateShowing; |
578 |
|
FModified := false; |
579 |
|
end; |
580 |
|
|
581 |
< |
{$if lcl_fullversion >= 2000000} |
581 |
> |
{$if lcl_fullversion >= 2000003} |
582 |
|
type |
583 |
|
|
584 |
|
{ THackedCustomComboBox } |
597 |
|
|
598 |
|
procedure TIBLookupComboEditBox.Change; |
599 |
|
begin |
600 |
< |
THackedCustomComboBox(self).CallChange; |
600 |
> |
if IsUnbound then |
601 |
> |
THackedCustomComboBox(self).CallChange |
602 |
> |
else |
603 |
> |
inherited Change; |
604 |
|
end; |
605 |
|
|
606 |
|
procedure TIBLookupComboEditBox.CloseUp; |
607 |
|
begin |
613 |
– |
inherited CloseUp; |
608 |
|
inherited DoEdit; |
609 |
+ |
inherited CloseUp; |
610 |
+ |
EditingDone; |
611 |
|
end; |
612 |
|
|
613 |
|
procedure TIBLookupComboEditBox.Select; |
614 |
|
begin |
615 |
|
inherited Select; |
616 |
< |
inherited DoEdit; |
616 |
> |
if IsUnbound then |
617 |
> |
inherited DoEdit; |
618 |
|
end; |
619 |
|
|
620 |
|
function TIBLookupComboEditBox.DoEdit: boolean; |