LCL: fixed AV when testing TFindDialog

git-svn-id: trunk@9745 -
This commit is contained in:
mattias 2006-08-23 19:49:03 +00:00
parent 6446572899
commit 5d98cce24c
3 changed files with 19 additions and 14 deletions

View File

@ -1297,7 +1297,6 @@ begin
EndFormUpdate; EndFormUpdate;
end; end;
//DebugLn('[TCustomForm.Create] END Class=',Classname); //DebugLn('[TCustomForm.Create] END Class=',Classname);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ end;
procedure TFindDialog.DoCloseForm(Sender: TObject; var CloseAction: TCloseAction); procedure TFindDialog.DoCloseForm(Sender: TObject; var CloseAction: TCloseAction);
begin begin
if csDesigning in ComponentState then exit;
with TFindDialogForm(Sender) do with TFindDialogForm(Sender) do
begin begin
if ModalResult <> mrCancel then if ModalResult <> mrCancel then
@ -164,7 +165,8 @@ end;
function TFindDialog.CreateForm: TForm; function TFindDialog.CreateForm: TForm;
begin begin
Result:=TFindDialogForm.Create(Self); Result:=TFindDialogForm.Create(nil);// do not use Self as Owner, otherwise as desgntime this will not work
DebugLn(['TFindDialog.CreateForm ',DbgSName(Result),' ',Result.ControlCount]);
with TFindDialogForm(Result) do begin with TFindDialogForm(Result) do begin
FindButton.Caption:=rsFind; FindButton.Caption:=rsFind;
CancelButton.Caption:=rsMbCancel; CancelButton.Caption:=rsMbCancel;
@ -179,21 +181,24 @@ begin
end; end;
procedure TFindDialog.UpdateValues; procedure TFindDialog.UpdateValues;
var
Dlg: TFindDialogForm;
begin begin
TFindDialogForm(FFindForm).EditFind.Text:=FFindText; Dlg:=TFindDialogForm(FFindForm);
Dlg.EditFind.Text:=FFindText;
TFindDialogForm(FFindForm).WholeWordsOnlyCheckBox.Checked:=frWholeWord in Options; Dlg.WholeWordsOnlyCheckBox.Checked:=frWholeWord in Options;
TFindDialogForm(FFindForm).CaseSensitiveCheckBox.Checked:=frMatchCase in Options; Dlg.CaseSensitiveCheckBox.Checked:=frMatchCase in Options;
TFindDialogForm(FFindForm).DirectionRadioGroup.ItemIndex:=ord(frDown in Options); Dlg.DirectionRadioGroup.ItemIndex:=ord(frDown in Options);
TFindDialogForm(FFindForm).WholeWordsOnlyCheckBox.Enabled:=not (frDisableWholeWord in Options); Dlg.WholeWordsOnlyCheckBox.Enabled:=not (frDisableWholeWord in Options);
TFindDialogForm(FFindForm).CaseSensitiveCheckBox.Enabled:=not (frDisableMatchCase in Options); Dlg.CaseSensitiveCheckBox.Enabled:=not (frDisableMatchCase in Options);
TFindDialogForm(FFindForm).DirectionRadioGroup.Enabled:=not (frDisableUpDown in Options); Dlg.DirectionRadioGroup.Enabled:=not (frDisableUpDown in Options);
TFindDialogForm(FFindForm).WholeWordsOnlyCheckBox.Visible:=not (frHideWholeWord in Options); Dlg.WholeWordsOnlyCheckBox.Visible:=not (frHideWholeWord in Options);
TFindDialogForm(FFindForm).CaseSensitiveCheckBox.Visible:=not (frHideMatchCase in Options); Dlg.CaseSensitiveCheckBox.Visible:=not (frHideMatchCase in Options);
TFindDialogForm(FFindForm).DirectionRadioGroup.Visible:=not (frHideUpDown in Options); Dlg.DirectionRadioGroup.Visible:=not (frHideUpDown in Options);
TFindDialogForm(FFindForm).HelpButton.Visible:=(frShowHelp in Options); Dlg.HelpButton.Visible:=(frShowHelp in Options);
end; end;
constructor TFindDialog.Create(AOwner: TComponent); constructor TFindDialog.Create(AOwner: TComponent);
@ -204,6 +209,7 @@ end;
destructor TFindDialog.Destroy; destructor TFindDialog.Destroy;
begin begin
FreeAndNil(FFindForm);
inherited Destroy; inherited Destroy;
end; end;

View File

@ -2595,7 +2595,7 @@ function InitLazResourceComponent(Instance: TComponent;
DestroyDriver: Boolean; DestroyDriver: Boolean;
Driver: TAbstractObjectReader; Driver: TAbstractObjectReader;
begin begin
//DebugLn('[InitComponent] ',ClassType.Classname,' ',Instance<>nil); //DebugLn(['[InitComponent] ',ClassType.Classname,' ',Instance<>nil]);
Result:=false; Result:=false;
if (ClassType=TComponent) or (ClassType=RootAncestor) then exit; if (ClassType=TComponent) or (ClassType=RootAncestor) then exit;
if Assigned(ClassType.ClassParent) then if Assigned(ClassType.ClassParent) then