PeterPanettone 157 Posted May 6, 2020 Does anybody know a Delphi IDE addon that is able to selectively HIDE single visual controls (e.g. TPanel, etc.) at design-time in the Form-Designer? That would be very convenient when working with multiple NESTED overlapping container controls. The IDE itself does not seem to have this feature. Share this post Link to post
Rollo62 536 Posted May 7, 2020 Maybe that helps: You can use the structure panel to access the hidden compenents you need. If you really need to see and touch the hidden piece, then you better move from VCL to FMX, there you can set them invisible 🙂 Share this post Link to post
PeterPanettone 157 Posted May 7, 2020 29 minutes ago, Rollo62 said: You can use the structure panel to access the hidden compenents you need. It is not a question of accessing the hidden visual components. Of course, they can be accessed and selected in the Structure Panel (and thus shown and their properties edited in the Object Inspector), but their container content visually edited. Imagine you have a TPanel (Panel1) hidden behind another panel (Panel2) and want to insert and visually edit some other controls inside this hidden Panel1. In such a case it would be convenient temporarily hiding the Panel2 in the Form-Designer. However, the question was about an addon having such a feature. Thank you for your observations. Share this post Link to post
PeterPanettone 157 Posted May 7, 2020 The functionality to hide a subset of components in the Form-Designer is already existing: Show Non-Visual Components in the Edit menu. Could that functionality be used by an add-on to selectively hide a single control component (and its sub-controls)? Share this post Link to post
haentschman 92 Posted May 7, 2020 Hi... How about Frames? Load the appropriate frame according to your requirements... 1 Share this post Link to post
Lars Fosdal 1792 Posted May 7, 2020 We make extensive use of frames in VCL. For FMX, it is not quite as clear cut... Share this post Link to post
Uwe Raabe 2057 Posted May 7, 2020 (edited) Quick-And-Dirty ( complete package attached ) unit HideControls; interface procedure Register; implementation uses Vcl.Controls, DesignIntf, DesignEditors; type THideControlsEditor = class(TComponentEditor) private procedure SetDesignVisible(Value: Boolean); public procedure ExecuteVerb(Index: Integer); override; function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; end; procedure Register; begin RegisterComponentEditor(TControl, THideControlsEditor); end; procedure THideControlsEditor.ExecuteVerb(Index: Integer); begin case Index of 0: SetDesignVisible(False); 1: SetDesignVisible(True); end; end; function THideControlsEditor.GetVerb(Index: Integer): string; begin case Index of 0: Result := 'Hide Control(s)'; 1: Result := 'Show Control(s)'; else Result := ''; end; end; function THideControlsEditor.GetVerbCount: Integer; begin Result := 2; end; procedure THideControlsEditor.SetDesignVisible(Value: Boolean); var I: Integer; list: IDesignerSelections; begin list := CreateSelectionList; Designer.GetSelections(list); for I := 0 to list.Count - 1 do if list.Items[I] is TControl then TControl(list.Items[I]).SetDesignVisible(Value); end; end. HideControlsAtDesignTimeDemo.zip Edited May 8, 2020 by Uwe Raabe wrong language 4 2 Share this post Link to post
PeterPanettone 157 Posted May 8, 2020 22 hours ago, Uwe Raabe said: HideControlsAtDesignTimeDemo.zip EXCELLENT piece of code! Thank you! Share this post Link to post
PeterPanettone 157 Posted May 8, 2020 43 minutes ago, PeterPanettone said: EXCELLENT piece of code! Embarcadero should include this in the Delphi IDE! My colleague has posted this quality report: https://quality.embarcadero.com/browse/RSP-28217 Please vote for it! Share this post Link to post
Uwe Raabe 2057 Posted May 8, 2020 Well, that code is far from usable in production. F.i. you can still select that invisible control - at least if the space is not occupied by something else. I also get AVs when I unload that package. Share this post Link to post
PeterPanettone 157 Posted May 8, 2020 52 minutes ago, Uwe Raabe said: Well, that code is far from usable in production. Well, I am sure the people at Embarcadero are able to do a bit more than Copy&Paste ... Share this post Link to post
PeterPanettone 157 Posted May 8, 2020 59 minutes ago, Uwe Raabe said: F.i. you can still select that invisible control For me, this is not a drawback. It perfectly fits my purpose. If you want, you could add a command "Show all hidden controls", because one might forget the different controls he has hidden. Share this post Link to post
toms 29 Posted May 8, 2020 (edited) This Delphi VCL component to view, edit, move and hide components on VCL form might also be interesting for you. It comes with full source code & has lots of features. Edited May 8, 2020 by toms Share this post Link to post