ViewUnit/Form dialog: remember checkbox (multi-select) state

git-svn-id: trunk@24203 -
This commit is contained in:
martin 2010-03-25 00:09:01 +00:00
parent 601db0896e
commit b6d77df111
2 changed files with 22 additions and 13 deletions

View File

@ -960,7 +960,8 @@ type
procedure SaveIncludeLinks;
function SelectProjectItems(ItemList: TStringList;
ItemType: TIDEProjectItem;
MultiSelect: boolean): TModalResult;
MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult;
// tools
function DoMakeResourceString: TModalResult;
@ -8580,7 +8581,8 @@ begin
end;
function TMainIDE.SelectProjectItems(ItemList: TStringList;
ItemType: TIDEProjectItem; MultiSelect: boolean): TModalResult;
ItemType: TIDEProjectItem; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult;
var
i: integer;
AUnitName, DlgCaption: string;
@ -8635,7 +8637,7 @@ begin
piComponent: DlgCaption := dlgMainViewForms;
piFrame: DlgCaption := dlgMainViewFrames;
end;
Result := ShowViewUnitsDlg(ItemList, MultiSelect, DlgCaption);
Result := ShowViewUnitsDlg(ItemList, MultiSelect, MultiSelectCheckedState, DlgCaption);
end;
function TMainIDE.DoSelectFrame: TComponentClass;
@ -8646,12 +8648,14 @@ var
LFMCode: TCodeBuffer;
LFMFilename: String;
TheModalResult: TModalResult;
dummy: Boolean;
begin
Result := nil;
UnitList := TStringList.Create;
UnitList.Sorted := True;
try
if SelectProjectItems(UnitList, piFrame, false) = mrOk then
dummy := false;
if SelectProjectItems(UnitList, piFrame, false, dummy) = mrOk then
begin
{ This is where we check what the user selected. }
AnUnitInfo := nil;
@ -8699,6 +8703,7 @@ end;
function TMainIDE.DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
const
UseItemType: array[Boolean] of TIDEProjectItem = (piUnit, piComponent);
MultiSelectCheckedState: Array [Boolean] of Boolean = (True,True);
var
UnitList: TStringList;
i: integer;
@ -8708,7 +8713,8 @@ begin
UnitList := TStringList.Create;
UnitList.Sorted := True;
try
if SelectProjectItems(UnitList, UseItemType[OnlyForms], true) = mrOk then
if SelectProjectItems(UnitList, UseItemType[OnlyForms],
true, MultiSelectCheckedState[OnlyForms]) = mrOk then
begin
{ This is where we check what the user selected. }
AnUnitInfo := nil;
@ -9930,6 +9936,8 @@ var
i:integer;
AName: string;
AnUnitInfo: TUnitInfo;
const
MultiSelectCheckedState: Boolean = true;
Begin
UnitList := TStringList.Create;
UnitList.Sorted := True;
@ -9944,7 +9952,7 @@ Begin
UnitList.AddObject(AName, TViewUnitsEntry.Create(AName,i,false));
end;
end;
if ShowViewUnitsDlg(UnitList, true, lisRemoveFromProject) = mrOk then
if ShowViewUnitsDlg(UnitList, true, MultiSelectCheckedState, lisRemoveFromProject) = mrOk then
begin
{ This is where we check what the user selected. }
for i:=0 to UnitList.Count-1 do

View File

@ -76,16 +76,16 @@ type
constructor Create(TheOwner: TComponent); override;
end;
function ShowViewUnitsDlg(Entries: TStringList; MultiSelect: boolean;
const Caption: string): TModalResult;
function ShowViewUnitsDlg(Entries: TStringList; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const Caption: string): TModalResult;
// Entries is a list of TViewUnitsEntry(s)
implementation
{$R *.lfm}
function ShowViewUnitsDlg(Entries: TStringList; MultiSelect: boolean;
const Caption: string): TModalResult;
function ShowViewUnitsDlg(Entries: TStringList; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const Caption: string): TModalResult;
var
ViewUnitDialog: TViewUnitDialog;
i: integer;
@ -93,9 +93,9 @@ begin
ViewUnitDialog:=TViewUnitDialog.Create(nil);
try
ViewUnitDialog.Caption:=Caption;
ViewUnitDialog.MultiselectCheckBox.Enabled:=MultiSelect;
ViewUnitDialog.MultiselectCheckBox.Checked:=MultiSelect;
ViewUnitDialog.ListBox.Multiselect:=ViewUnitDialog.MultiselectCheckBox.Checked;
ViewUnitDialog.MultiselectCheckBox.Enabled := AllowMultiSelect;
ViewUnitDialog.MultiselectCheckBox.Checked := CheckMultiSelect;
ViewUnitDialog.ListBox.MultiSelect:=ViewUnitDialog.MultiselectCheckBox.Checked;
with ViewUnitDialog.ListBox.Items do begin
BeginUpdate;
Clear;
@ -110,6 +110,7 @@ begin
for i:=0 to Entries.Count-1 do begin
TViewUnitsEntry(Entries.Objects[i]).Selected:=ViewUnitDialog.ListBox.Selected[i];
end;
CheckMultiSelect := ViewUnitDialog.MultiselectCheckBox.Checked;
end;
finally
ViewUnitDialog.Free;