[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Custom Widget question
|
Hmm... you're right. But I think it's the only way to hide the
ScrolledComposite.
You can do something like this in your constructor to get around the "super
has to be the first call" requirement.
You'll probably have to use a FormLayout on the widgetParent to get
everything to lay out properly, because the other SWT layout classes care
about the creation order of the child controls, i.e. in this scenario, the
header & footer will be created before the ScrolledComposite. FormLayout is
powerful enough to draw them where you want them no matter what order they
are created in.
MyScrolledComposite(Composite parent, int style) {
super(widgetParent(parent, style),style);
}
Composite widgetParent(Composite parent, int style) {
Composite widgetParent = new Composite(parent,style);
canvas header = new Canvas(widgetParent);
...
return widgetParent
}
I'm not entirely sure that there isn't some "gotcha" somewhere, but I hope
this helps.
Carolyn
"Philipp Simon" <philipp_simon@xxxxxx> wrote in message
news:81b44428a0ced64fc0df1b77eaf78252$1@xxxxxxxxxxxxxxxxxx
> Hm also thought about doing it that way but the first problem coming up is
> that then i would have to write a Constructor looking like:
>
> ScrolledComposite(parent,style){
> Composite widgetParent = new Composite(parent,style);
> ..
> canvas header = new Canvas(widgetParent);
> super(widgetParent,style);
> ..
> }
>
> and this aint working ( super call has to be first line). Beside that a
> lot of methods would have to be overwritten to simply direct to the
> "widgetParent"'s ones ( which doesn't looke nice but would work fine i
> think).
>
> Am i missing something here?
>
> thanks,
> Philipp
>