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;
end;
//DebugLn('[TCustomForm.Create] END Class=',Classname);
end;
{------------------------------------------------------------------------------

View File

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

View File

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