ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/ibcontrols/IBLookupComboEditBox.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/IBLookupComboEditBox.pas (file contents):
Revision 80 by tony, Mon Jan 1 11:31:07 2018 UTC vs.
Revision 217 by tony, Fri Mar 16 10:27:26 2018 UTC

# Line 31 | Line 31 | interface
31  
32   uses
33    Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DbCtrls,
34 <  ExtCtrls, IBSQLParser, DB, StdCtrls, IBCustomDataSet, LCLVersion;
34 >  ExtCtrls, IBSQLParser, DB, StdCtrls, IBCustomDataSet;
35  
36   type
37  
# Line 54 | Line 54 | type
54      FOwner: TIBLookupComboEditBox;
55    protected
56      procedure ActiveChanged; override;
57 +    procedure DataEvent(Event: TDataEvent; Info: Ptrint); override;
58      procedure RecordChanged(Field: TField); override;
59      procedure UpdateData; override;
60    public
# Line 76 | Line 77 | type
77  
78    TIBLookupComboEditBox = class(TDBLookupComboBox)
79    private
79    FCanAutoInsert: TCanAutoInsert;
80      { Private declarations }
81      FDataLink: TIBLookupComboDataLink;
82      FIBLookupControlLink: TIBLookupControlLink;
# Line 96 | Line 96 | type
96      FInCheckAndInsert: boolean;
97      FLastKeyValue: variant;
98      FCurText: string;
99 +    FModified: boolean;
100      procedure DoActiveChanged(Data: PtrInt);
101      function GetAutoCompleteText: TComboBoxAutoCompleteText;
102      function GetListSource: TDataSource;
# Line 122 | Line 123 | type
123      procedure SetItemIndex(const Val: integer); override;
124      function SQLSafe(aText: string): string;
125      procedure UpdateShowing; override;
126 <
126 >    procedure UpdateData(Sender: TObject); override;
127    public
128      { Public declarations }
129      constructor Create(TheComponent: TComponent); override;
# Line 146 | Line 147 | type
147  
148   implementation
149  
150 < uses IBQuery, LCLType, Variants, LCLProc, LazUTF8;
150 > uses LCLType, Variants, LCLProc, LazUTF8;
151  
152   { TIBLookupControlLink }
153  
# Line 168 | Line 169 | begin
169    FOwner.ActiveChanged(self)
170   end;
171  
172 + procedure TIBLookupComboDataLink.DataEvent(Event: TDataEvent; Info: Ptrint);
173 + begin
174 +  inherited DataEvent(Event, Info);
175 +  if Event = deLayoutChange then
176 +   FOwner.LookupCache := FOwner.LookupCache; {sneaky way of calling UpdateLookup}
177 + end;
178 +
179   procedure TIBLookupComboDataLink.RecordChanged(Field: TField);
180   begin
181    FOwner.RecordChanged(self,Field);
# Line 187 | Line 195 | end;
195   { TIBLookupComboEditBox }
196  
197   procedure TIBLookupComboEditBox.HandleTimer(Sender: TObject);
190 var ActiveState: boolean;
198   begin
199    FTimer.Interval := 0;
200    FFiltered := Text <> '';
# Line 360 | Line 367 | begin
367      finally
368        FUpdating := false
369      end;
370 +    FModified := true;
371    end;
372   end;
373  
# Line 551 | Line 559 | begin
559      ActiveChanged(nil);
560   end;
561  
562 + procedure TIBLookupComboEditBox.UpdateData(Sender: TObject);
563 + begin
564 +  inherited UpdateData(Sender);
565 +  FModified := false;
566 + end;
567 +
568   constructor TIBLookupComboEditBox.Create(TheComponent: TComponent);
569   begin
570    inherited Create(TheComponent);
# Line 583 | Line 597 | begin
597      FForceAutoComplete := false;
598    end;
599    CheckAndInsert;
600 +  if FModified then
601 +    Change; {ensure Update}
602    inherited EditingDone;
603   end;
604  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines