1
0
mirror of synced 2024-11-14 16:33:54 +00:00

Fixed: Access Violation in View Unit

This commit is contained in:
Mark van Renswoude 2006-01-05 21:14:36 +00:00
parent 27a1a5023f
commit 277497d7c5

View File

@ -30,24 +30,25 @@ type
TfrmUnSwDialog = class(TForm) TfrmUnSwDialog = class(TForm)
btnCancel: TButton; btnCancel: TButton;
btnOK: TButton; btnOK: TButton;
chkDataModules: TCheckBox;
chkForms: TCheckBox;
chkProjectSource: TCheckBox;
edtSearch: TEdit; edtSearch: TEdit;
ilsTypes: TImageList; ilsTypes: TImageList;
lstUnits: TListBox; lstUnits: TListBox;
pnlButtons: TPanel; pnlButtons: TPanel;
pnlIncludeTypes: TPanel;
pnlMain: TPanel; pnlMain: TPanel;
pnlSearch: TPanel; pnlSearch: TPanel;
sbStatus: TStatusBar; sbStatus: TStatusBar;
chkForms: TCheckBox;
chkDataModules: TCheckBox;
chkProjectSource: TCheckBox;
pnlIncludeTypes: TPanel;
procedure TypeFilterChange(Sender: TObject);
procedure edtSearchChange(Sender: TObject); procedure edtSearchChange(Sender: TObject);
procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure TypeFilterChange(Sender: TObject);
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string); procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
private private
FLoading: Boolean;
FUnitList: TUnSwUnitList; FUnitList: TUnSwUnitList;
FActiveUnit: TUnSwUnit; FActiveUnit: TUnSwUnit;
FFormsOnly: Boolean; FFormsOnly: Boolean;
@ -73,6 +74,7 @@ type
implementation implementation
uses uses
DIalogs,
SysUtils, SysUtils,
Graphics; Graphics;
@ -122,19 +124,24 @@ function TfrmUnSwDialog.InternalExecute(): TUnSwUnit;
begin begin
Result := nil; Result := nil;
if not FFormsOnly then
begin
chkForms.Checked := FTypeFilter.IncludeForms;
chkDataModules.Checked := FTypeFilter.IncludeDataModules;
chkProjectSource.Checked := FTypeFilter.IncludeProjectSource;
end else
pnlIncludeTypes.Visible := False;
FTypeFilteredList := TUnSwUnitList.Create(); FTypeFilteredList := TUnSwUnitList.Create();
FInputFilteredList := TUnSwUnitList.Create(); FInputFilteredList := TUnSwUnitList.Create();
FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList); FTypeFilter := TUnSwUnitTypeFilter.Create(FTypeFilteredList);
FInputFilter := TUnSwUnitSimpleFilter.Create(FInputFilteredList); FInputFilter := TUnSwUnitSimpleFilter.Create(FInputFilteredList);
try try
if not FFormsOnly then
begin
FLoading := True;
try
chkForms.Checked := FTypeFilter.IncludeForms;
chkDataModules.Checked := FTypeFilter.IncludeDataModules;
chkProjectSource.Checked := FTypeFilter.IncludeProjectSource;
finally
FLoading := False;
end;
end else
pnlIncludeTypes.Visible := False;
UpdateTypeFilter(); UpdateTypeFilter();
FIconVisitor := TUnSwIconVisitor.Create(); FIconVisitor := TUnSwIconVisitor.Create();
@ -227,7 +234,8 @@ end;
procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject); procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject);
begin begin
UpdateTypeFilter(); if not FLoading then
UpdateTypeFilter();
end; end;
procedure TfrmUnSwDialog.lstUnitsData(Control: TWinControl; Index: Integer; procedure TfrmUnSwDialog.lstUnitsData(Control: TWinControl; Index: Integer;