• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add a new widget to a child component of a custom SWT widget

 
Jay Damon
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying my hand at creating some custom widgets in SWT. One of my custom widgets wraps a Composite widget. If, when creating a child of the custom widget, e.g. Button, Text, etc., the child is created as child of the custom widget. I would like all child widgets to created as children of the wrapped Composite widget. In other words, no child widget should be created as a child of the custom widget; all child widgets may only be children of the Composite widget. The custom widget works fine in all other respects. As a workaround I have created a method named getWidget which I invoke to get a reference to the proper parent object when creating a Button, Text, etc. I would like to be able pass a reference to the custom widget directly to the constructors of Button, Text, etc. just like any other widget but I do not see how this might be done. Note that my custom widget does subclass Composite. Is this possible? Any suggestions would be appreciated. Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!