So trying to make some widget wrapper I just discovered that I need a make operator, which is bolted down as internal. Is there any way I can extend Widget to wrap Widgets around it?
brianFri 24 Sep 2010
When you create a new widget you need to subclass from Pane or Canvas.
Ok, new question, is there an elegant way to pass an extra information during Widget addition to a Pane? I tried to alter Widget.add(newWidget) to MyWidget.add(newWidget, "constraints") but it didn't work, sadly.
andySat 25 Sep 2010
You cannot modify add since that is used for serialization. The workaround proposed (see #961) is to add a new Widget.layout field:
MyPane { MyWidget { layout="foo" }, }
DanielFathSat 25 Sep 2010
Yeah, I've read that. Still, since there are no tickets what other ways could I achieve this?
andySat 25 Sep 2010
Unfortunately there is no good way, thats why this is needed. The one case I used it, I think I used a map in my custom Pane and painfully assigned somewhere along these lines:
class MyPane { Widget:Str constraints := [:] }
MyPane
{
b := Button("Foo")
add(b)
constraints[b] = "foo"
}
DanielFathSat 25 Sep 2010
Thanks. In case you do implement it, will you make layout Obj or Str?
DanielFath Fri 24 Sep 2010
So trying to make some widget wrapper I just discovered that I need a make operator, which is bolted down as internal. Is there any way I can extend Widget to wrap Widgets around it?
brian Fri 24 Sep 2010
When you create a new widget you need to subclass from Pane or Canvas.
Take a look at http://fantom.org/doc/fwt/pod-doc.html#customWidgets
DanielFath Fri 24 Sep 2010
Ok, new question, is there an elegant way to pass an extra information during Widget addition to a Pane? I tried to alter
Widget.add(newWidget)
toMyWidget.add(newWidget, "constraints")
but it didn't work, sadly.andy Sat 25 Sep 2010
You cannot modify
add
since that is used for serialization. The workaround proposed (see #961) is to add a newWidget.layout
field:DanielFath Sat 25 Sep 2010
Yeah, I've read that. Still, since there are no tickets what other ways could I achieve this?
andy Sat 25 Sep 2010
Unfortunately there is no good way, thats why this is needed. The one case I used it, I think I used a map in my custom Pane and painfully assigned somewhere along these lines:
DanielFath Sat 25 Sep 2010
Thanks. In case you do implement it, will you make layout
Obj
orStr
?