Forum > Editor
IDE - Panel hide away!
Handoko:
Did OP mean a feature that can show/hide component on design time?
--- Quote from: Nicole on February 23, 2024, 05:08:49 pm ---As everybody has this topic, there shall be better ways to handle this.
--- End quote ---
If I understood your issue correctly, my solutions are:
Use TFrame. It should works for someone but I personally don't like TFrame.
Instead I use TForm. On OnCreate, the form will be showed/positioned into a TPanel.
TFrame and TForm are very useful to simplify complex UI layout. But I usually prefer to generate the UI components at runtime by code. There are some advantages generating them by code than by using the visual editor.
TRon:
--- Quote from: Handoko on February 23, 2024, 05:41:15 pm ---Did OP mean a feature that can show/hide component on design time?
--- End quote ---
That would most probably be the better solution for OP (or anyone else having to deal with such feature).
Note that your embedded form solution is a nice one but probably has quirks when using another widgetset yes or no in combination with certain window managers (Linux).
wp:
--- Quote from: Nicole on February 23, 2024, 05:08:49 pm ---The elements BELOW these panel are complicated to work with. So I shift the panel and on next run its position is lost.
[...]
As everybody has this topic, there shall be better ways to handle this. Please be so kind to share them with me.
--- End quote ---
Better ways, yes, definitely. One of the most ignored, but most powerful features in the LCL - ChildSizing.
* Drop the containers (e.g. a panel with other controls that you want to show/hide depending on context) in a panel, roughly position them so that you can work with them, but keep their Align settings unchanged.
* Then activate ChildSizing of the panel: When the containers should be stacked vertically set Panel.ChildSizing.Layout to cclLeftToRigthThenTopToBottom; with Panel.ChildSizing.ControlsPerLine at the default of 0 or at 1 you get one column of nicely stacked controls (if you want more columns set the ControlsPerLine accordingly).
* When you now hide one or more containers and reshow them later their order remains unchanged.
* The order is the order in which they were added. If you want to move a container up you must right-click on it (or on its node in the object tree) and select "Z-Order" > "Move to front" if you want it at the top, "Move to back" if you want it at the bottom, "Forward one" if you want it to change its place with the next lower one, or "Back one" if you want it at one place higher. (or the other way around - I always forget...)See attached demo.
vfclists:
--- Quote from: VisualLab on February 23, 2024, 05:31:17 pm ---
--- Quote from: Nicole on February 23, 2024, 05:08:49 pm ---Some functions are to display and to hide away. These functions I group on an invisible panel. A button allows at runtime to display the panel with its functions. The second click hides the panel away again.
This is a fine solution at runtime. But how to work with it at design time? The elements BELOW these panel are complicated to work with. So I shift the panel and on next run its position is lost. I found a thing called "z-order". I am not sure how it works and it never does what I want.
As everybody has this topic, there shall be better ways to handle this. Please be so kind to share them with me.
--- End quote ---
This is useful when you need to change the order in which sibling window controls overlap with each other. To move controls programmatically you can use: BrignTo Front and SendToBack.
You can also use TNotebook or TPageControl controls. They both have pages. Except that TPageControl has tabs (they can be hidden).
--- End quote ---
I think you already have your answer from VisualLab. It is the part I have highlighted in bold.
Another thing I want to add is that if committing your code to a source code control system is important to you, the form designer is hell, as it means you get spurious changes as you move stuff around, sometimes just to gain access to some controls to make the changes you want.
Write everything in code as much as you can or else you will be in a whole world of pain when you are constantly squinting at the changes in the LFMs to see what matters and what doesn't
Nicole:
Thank you for all answers.
@vfclists
is there an easy online way to do it?
At the moment I make a full copy of my project after every step which works.
And at the end of the day I use the freeware PersonalBackup, which was originally written by a Delphi genius who wanted to safe his own project files in a way, they make sense. e.g. nobody wants to save the backup-folders or huge exe every day. This is the Swiss knife for making an offline copy.
Navigation
[0] Message Index
[#] Next page
[*] Previous page