Skip to main content

Binding sequences and inverse binding

1 reply [Last post]
Joined: 2008-10-02

Hello guys,

I have the following code:

<br />
content: bind [<br />
    for (i in [0..(sizeof mapRef.lines -1)])<br />
    FlowPanel {<br />
         content: [<br />
             Label {<br />
                   text: mapRef.lines[i].lineName<br />
             },<br />
             ComboBox {<br />
                    selectedIndex: mapRef.lines[i].coloursIndex<br />
                    items: bind [<br />
                         for (colour in model.LinesModel.colourNames)<br />
                         ComboBoxItem {<br />
                               text: colour<br />
                         }<br />
                    ]<br />
            }<br />
      ]<br />
   }<br />
]<br />

I have a sequence of an unknown number of objects that are called "lines" and I want to select they colour using a ComboBox. This is easy while you have just one line and you go:

selectedIndex: bind line.coloursIndex with inverse

but in this case, when you have a sequence of objects and you want to bind them also with inverse, I find that impossible.

Any idea around? I'm quite desperate here because I can't think about any different way.

Thanks in advance

(Sorry I also posted this in OpenJFX general discussion forum, I thought this one is more appropriate and well, I really need your help guys).

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-09-24

perhaps you can make one custom node object wich is working good (you say one line is working) and you manage your differents lines as objects array.
In fact try to use an array of object wich have n parameters instead of n array of objects,
good luck!