dormky 2 Posted March 8 (edited) Hello, I have a series of 4 numbers describing current atmospheric conditions, currently shown in a TGroupBox with each number in a TEdit. I'd like to encapsulate the behavior related to these numbers (color changes) into a component so I can re-use it in multiple places. I've created a new component based on TGroupBox, but when opening it there's no Design tab, and I don't want to use code to describe the UI as this runs opposite to what is generally done in Delphi (where you use a graphic UI editor). How can I get my custom TGroupBox component in a Design tab so I can edit it (with a .dfm) ? Edited March 8 by dormky Share this post Link to post
Tom Chamberlain 47 Posted March 8 You may want to look at frames. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Working_with_Frames Different functionality and usage than creating a real component but may be what you are looking for. I have never used frames myself, but have several custom components to combine TEdit's, TComboBox's and TButton's into a TPanel that are added to a TScrollbox on the fly with different data in each. Share this post Link to post
PeterBelow 238 Posted March 8 You cannot, subcomponents in a custom component are created in an overridden constructor. But there is an alternative: Create a new frame in the designer and place groupbox and edits on it. Save the frame unit (after changing the Name property of the frame to something descriptive), best into a folder where you stash code units you want to reuse in other projects. To use the frame in another project just add its unit to the project. A frame behaves much like a component, you can drop multiple instances of it on forms, panels or other containers. But it can also hold code like a form, in event handlers or methods, and this code is shared between all frame instances. You can modify properties of the controls on the frame in the designer for each instance separately. Share this post Link to post
dummzeuch 1505 Posted March 8 There is also Delphi Custom Containers Pack. For some types of components I prefer that over frames. Share this post Link to post