mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 12:30:36 +02:00
IDE: unused units: enable ok button depending on selection
git-svn-id: trunk@19355 -
This commit is contained in:
parent
8433edc068
commit
9f6ed9ea7d
@ -19,14 +19,16 @@ object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
ShowBevel = False
|
||||
end
|
||||
object UnitsTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 317
|
||||
Top = 0
|
||||
Width = 340
|
||||
Left = 6
|
||||
Height = 311
|
||||
Top = 6
|
||||
Width = 328
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
DefaultItemHeight = 19
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 1
|
||||
OnSelectionChanged = UnitsTreeViewSelectionChanged
|
||||
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
end
|
||||
|
@ -7,9 +7,11 @@ LazarusResources.Add('TUnusedUnitsDialog','FORMDATA',[
|
||||
+'T'#1#8'OnCreate'#7#10'FormCreate'#10'LCLVersion'#6#6'0.9.27'#0#12'TButtonPa'
|
||||
+'nel'#12'ButtonPanel1'#4'Left'#2#6#6'Height'#2'$'#3'Top'#3'C'#1#5'Width'#3'H'
|
||||
+#1#8'TabOrder'#2#0#11'ShowButtons'#11#4'pbOK'#8'pbCancel'#0#9'ShowBevel'#8#0
|
||||
+#0#9'TTreeView'#13'UnitsTreeView'#4'Left'#2#0#6'Height'#3'='#1#3'Top'#2#0#5
|
||||
+'Width'#3'T'#1#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#19#10'ScrollBa'
|
||||
+'rs'#7#10'ssAutoBoth'#8'TabOrder'#2#1#7'Options'#11#19'tvoAllowMultiselect'
|
||||
+#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#14'tvo'
|
||||
+'ShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0
|
||||
+#0#9'TTreeView'#13'UnitsTreeView'#4'Left'#2#6#6'Height'#3'7'#1#3'Top'#2#6#5
|
||||
+'Width'#3'H'#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#17'Defaul'
|
||||
+'tItemHeight'#2#19#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#1#18'OnSele'
|
||||
+'ctionChanged'#7#29'UnitsTreeViewSelectionChanged'#7'Options'#11#19'tvoAllow'
|
||||
+'Multiselect'#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsed'
|
||||
+'Nodes'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0
|
||||
+#0#0#0
|
||||
]);
|
||||
|
@ -46,6 +46,7 @@ type
|
||||
UnitsTreeView: TTreeView;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure OkClick(Sender: TObject);
|
||||
procedure UnitsTreeViewSelectionChanged(Sender: TObject);
|
||||
private
|
||||
FUnits: TStrings;
|
||||
ImgIDInterface: LongInt;
|
||||
@ -54,6 +55,7 @@ type
|
||||
ImgIDNone: LongInt;
|
||||
procedure SetUnits(const AValue: TStrings);
|
||||
procedure RebuildUnitsTreeView;
|
||||
procedure UpdateButtons;
|
||||
public
|
||||
function GetSelectedUnits: TStrings;
|
||||
property Units: TStrings read FUnits write SetUnits;
|
||||
@ -136,6 +138,11 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TUnusedUnitsDialog.UnitsTreeViewSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TUnusedUnitsDialog.SetUnits(const AValue: TStrings);
|
||||
begin
|
||||
if FUnits=AValue then exit;
|
||||
@ -187,6 +194,16 @@ begin
|
||||
IntfTreeNode.Expanded:=true;
|
||||
ImplTreeNode.Expanded:=true;
|
||||
UnitsTreeView.EndUpdate;
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TUnusedUnitsDialog.UpdateButtons;
|
||||
var
|
||||
RemoveUnits: TStrings;
|
||||
begin
|
||||
RemoveUnits:=GetSelectedUnits;
|
||||
ButtonPanel1.OKButton.Enabled:=RemoveUnits.Count>0;
|
||||
RemoveUnits.Free;
|
||||
end;
|
||||
|
||||
function TUnusedUnitsDialog.GetSelectedUnits: TStrings;
|
||||
|
Loading…
Reference in New Issue
Block a user