Greetings!
I recently upgraded to the bindings-supported version of Windowbuilder, and I love it. I've been redoing all my GUIs to use it. I recently found an issue, though, which I hope can be resolved.
Almost all the data fields on my main form reference one object, called "Environment", which I now bind to. All the properties in that object fire change events, so my bound controls update properly. However, the Environment object itself can be changed by the user, loading a marshalled version of the object from disk. I am of course using get/set in the form to set the Environment object, but when it changes, the bound controls do not update to the field values in the new object unless I call InitDataBindings() again, and I do not think that's the right thing to do.
That is:
Form is created, and it loads a default Environment object from disk. Code is something like "setEnvironment(LoadEnvironment(FileName))";
After this environment has been loaded, InitDataBindings is called for the first time.
The form is displayed and binding works.
The user then selects "Load Environment" from the menu. Another environment is loaded, something like this:
Environment new=LoadEnvironment(FileName);
if(new!=null) setEnvironment(new);
And then the binding doesn't update.
If I call InitDataBindings in setEnvironment, it does work, but, again, I don't think that's right. I've come up with a number of baroque ideas I think will fix it, but they all seem more complex than should be required; I think there's something very simple and obvious I'm missing. Please help?
Thanks.