IDE - Panel hide away! lazarus / 9-Editor ---------------------------------------------------------------------- Nicole · 2024-02-23 16:08 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. ---------------------------------------------------------------------- KodeZwerg · 2024-02-23 16:27 I am unsure what you talk about, it sound like a component but wait, we are in the IDE/Editor forum... Please explain it better, in best case with screenshots. ---------------------------------------------------------------------- VisualLab · 2024-02-23 16:31 Quote from: Nicole on February 23, 2024, 05:08:49 pmSome 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. 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). ---------------------------------------------------------------------- Josh · 2024-02-23 16:34 If it were me,I would move it out the way. then in the form onactivate or form onshow or the code that the button runs move it back where needed. you could send the panel to back in object inspector of the panel, but then its out of sight,i like things to be in sight even if not in right location. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ....  mypanel.top:=mybutton.top+mybutton.height+4;//or absolute address if only one widgetset   mypanel.left:=mybutton.left;//or absolute address if only one widgetset...// code for button...  mypanel.visible:=not mypanel.visible;  if mypanel.visible then  begin    mypanel.bringtofront;    mypanel.invalidate;  end;..... ---------------------------------------------------------------------- TRon · 2024-02-23 16:35 At designtime use two panels: one for your 'shift' panel and one for your client area. Align the shift panel to the left and the other panel to the client rectangle of the form. On formcreate event remove the alignment of the shift panel and change the z-order as suggested by VisualLab. That should be able to make things workable for you at designtime. Perhaps you also need to change the size (width) of the window at form creation (form.width := formwidth - shiftpanel.width to not make it too obvious there is space reserved for your shifting panel. ---------------------------------------------------------------------- Handoko · 2024-02-23 16:41 Did OP mean a feature that can show/hide component on design time? Quote from: Nicole on February 23, 2024, 05:08:49 pmAs everybody has this topic, there shall be better ways to handle this. 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 · 2024-02-23 18:04 Quote from: Handoko on February 23, 2024, 05:41:15 pmDid OP mean a feature that can show/hide component on design time? 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 · 2024-02-23 18:25 Quote from: Nicole on February 23, 2024, 05:08:49 pmThe 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. 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 · 2024-02-24 16:27 Quote from: VisualLab on February 23, 2024, 05:31:17 pmQuote from: Nicole on February 23, 2024, 05:08:49 pmSome 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. 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). 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 · 2024-02-24 17:08 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. ---------------------------------------------------------------------- lainz · 2024-02-24 21:13 Quote from: Nicole on February 24, 2024, 06:08:51 pmThank 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. SVN, GIT ---------------------------------------------------------------------- vfclists · 2024-02-24 21:55 Quote from: Nicole on February 24, 2024, 06:08:51 pmThank 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. Git is the tool you probably want to familiarize yourself with, but the UIs available for it are horrendous. Grasping the concepts behind it through the tools available is rather hard, and far as Git is concerned, installing Emacs just to be able to use Magit is probably worth it, whether on Windows or Linux. TortoiseGit on Windows will be good to get you going. If just tagging and saving snapshots is your main need it then any backup tool that does tagged and labelled snapshots of a directory will be fine, like the PersonalBackup tool you mentioned. ---------------------------------------------------------------------- lainz · 2024-02-24 23:17 I personally use Source tree that's git for mac and Windows. Also you have Github client. If you want to pay you have GitKraken.