The best way to create "multicomponents" lazarus / 31-LCL ---------------------------------------------------------------------- pebe · 2022-03-29 07:28 I wanted to create a component (control) which would consist of several others, for example TEdit and TComboBox (As in the picture in attachment) Such a component I wanted to use many times depending on the needs. In your opinion, what is the best way to implement such a task? ---------------------------------------------------------------------- af0815 · 2022-03-29 07:50 You can look at the Tab 'Misc' in Lazarus. There is a TEditButton and some other compound Components. There you can look how it works. ---------------------------------------------------------------------- howardpc · 2022-03-29 08:26 For an example of how not to implement a compound component there is TLabeledEdit on the Additional page. ---------------------------------------------------------------------- wp · 2022-03-29 09:19 Two simple possibilities come to my mind: Frame: You can do this without having to install a component: Create a TFrame and add the components that you want to combine. Add all the code needed. Save. In your project drop a TFrame and select the newly generated frame, and you'll have everything at place. Note, however, that adding frames at designtime cause occasional problems, therefore, I recommend to create and add the frame at runtime. Have a look at (lazarus)/components/tachart/demo/charteditor which excessively makes use of frames.Panel: Create a new component descending from TPanel. Add the components that you want to combine, and add the code needed. Save the component to a package, register it, install. This way you have a new component on the palette. Note, however, that in this simple approach the base component is still a TPanel and you can add further components which probably will  disturb your intentions - in order to avoid this issue you must follow the much more complex approach of TEditButton and related. ---------------------------------------------------------------------- pebe · 2022-03-29 18:45 I had little time to explain in more depth the essence of such an implementation and here may have been a problem with understanding. I hasten to explain. First of all, the whole component is to be created at runtime, why? Because it is supposed to be a component for searching data. The Edit field is a search value, and ComboBox, the operator `AND` or `OR`. Probably there will be another ComboBox with the type of comparison (eg =, >, <, LIKE, etc.). Hence the approach. I want to be able to easily access information by putting a complex component into an array and reading the next defined information. Maybe someone has another suggestion at this point? @af0815 In the example you gave (and indeed not only in this example) the intermediate class TCustomSomething is often used.... Where does this approach come from? Can this be solved by building a class (hypothetical approach) 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 Type  TSearchComponent = class    Value:TEdit;    Operator:TComboBox;    Constructor     Some methods and properties    Destructor   end;  If so, what is most convenient to inherit from? Because I understand that TControl is too "primitive" for components assembled this way, i.e. it's good, however it requires a lot of implementation Forgive the somewhat layman approach, I'm not used to Lazarus - I moved almost directly from JavaScript and React where the components were created quite differently (not to say simpler) ---------------------------------------------------------------------- howardpc · 2022-03-29 22:06 The attached project gives you a very simple-minded example of a profoundly basic compound search component based on TCustomControl. The TCustomXXX approach is commonly found in the VCL and LCL. The idea is to have an ancestor with working public functionality, from which you can easily create a descendant which publishes only those properties and events which make sense for your descendant. A problem in OOP designs is that once a property is published, it is difficult to hide that published property in a subsequent descendant (it might be a grandchild or great-grandchild) if it is not wanted or is inappropriate. Also having unnecessary properties published adds unnecessarily to the control's memory footprint and load time. Hence the design of a "slim" TCustom ancestor from which you publish only those  properties that are actually needed. ---------------------------------------------------------------------- pebe · 2022-03-30 05:40 @howardpc: I lack words to express my gratitude for the wonderfully imparted knowledge. The example you gave is exactly as I imagined. I will be free to continue with my vision Thank you very much and Regards.