lcl: fix possible access violation by setting lookup after handle creation of lookup controls

git-svn-id: trunk@32918 -
This commit is contained in:
blikblum 2011-10-16 10:49:56 +00:00
parent 21a7f6daf5
commit c42f1fd451
3 changed files with 11 additions and 11 deletions

View File

@ -437,8 +437,8 @@ Type
protected protected
procedure DataChange(Sender: TObject); override; procedure DataChange(Sender: TObject); override;
procedure DoSelectionChange(User: Boolean); override; procedure DoSelectionChange(User: Boolean); override;
procedure InitializeWnd; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Loaded; override;
procedure UpdateData(Sender: TObject); override; procedure UpdateData(Sender: TObject); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -755,8 +755,8 @@ Type
procedure SetNullValueKey(const AValue: TShortCut); procedure SetNullValueKey(const AValue: TShortCut);
procedure UpdateLookup; procedure UpdateLookup;
protected protected
procedure InitializeWnd; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Loaded; override;
procedure UpdateData(Sender: TObject); override; procedure UpdateData(Sender: TObject); override;
procedure DataChange(Sender: TObject); override; procedure DataChange(Sender: TObject); override;
public public

View File

@ -56,9 +56,9 @@ begin
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
end; end;
procedure TDBLookupComboBox.Loaded; procedure TDBLookupComboBox.InitializeWnd;
begin begin
inherited Loaded; inherited InitializeWnd;
if FDataLink.Active then if FDataLink.Active then
UpdateLookup; UpdateLookup;
end; end;

View File

@ -59,6 +59,13 @@ begin
inherited DoSelectionChange(User); inherited DoSelectionChange(User);
end; end;
procedure TDBLookupListBox.InitializeWnd;
begin
inherited InitializeWnd;
if FDataLink.Active then
UpdateLookup;
end;
procedure TDBLookupListBox.KeyDown(var Key: Word; Shift: TShiftState); procedure TDBLookupListBox.KeyDown(var Key: Word; Shift: TShiftState);
begin begin
if FLookup.HandleNullKey(Key, Shift) then if FLookup.HandleNullKey(Key, Shift) then
@ -71,13 +78,6 @@ begin
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
end; end;
procedure TDBLookupListBox.Loaded;
begin
inherited Loaded;
if FDataLink.Active then
UpdateLookup;
end;
function TDBLookupListBox.GetKeyField: string; function TDBLookupListBox.GetKeyField: string;
begin begin
Result := FLookup.KeyField; Result := FLookup.KeyField;