myerramalli wrote:I have two custom widgets TabFolder and TabItem, whose functionality is same as normal SWT widgets (but not directly derived from TabFolder and TabItem of SWT )
I placed the TabFolder on shell and try to place the TabItem under it. The designer would not allow me to do so.
I place the tabItem on the shell, go to the source change its parent to TabFolder. From now on the designer allows me to place the TabItems inside TabFolder.
Why does the desginer recognize the containment relationship after changing the source??
When adding a custom Composite subclass (which I assume your TabFolder is), Designer treats any class that defines its own children as a self-contained custom panel which may not have additional children added to it outside of its own class definition (this is certainly the general case). A custom Composite subclass that does not define its own children can be used as a custom container.
Once you modify the source code to change the parent/child relationships, Designer re-parses the code and identifies the custom Composite as a valid container (because it has child). From that point on, you add additional children to it.
BTW, if you want to create a custom TabFolder that will behave like a TabFolder in Designer, you should subclass the TabFolder (or CTabFolder) class rather than the Composite class.