Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Data Binding
Whilst I intend to test this myself, if someone has a more immediate answer it might save me some time by allowing me to choose the best design approach from the outset.
If I have a bunch of databound controls on a form and I use the 'addctrls' method to move them within a panel, do they retain their databoundedness and their relationship with the rest of the form?
I have a form that has all the databound controls I require already on it. I now have a requirement where, based on a condition set on the form, I may want to replace those controls by embedding an entire other window into the form.
I want to know if I can just leave the panel on the form and switch between the existing controls and the other window as the condition changes. If I can't retain the data binding, then I expect I would need to create a third window containing the controls and just switch between the two windows.
The second approach might be neater but based on the starting point would probably be more work.
Open to suggestions.
If I have a bunch of databound controls on a form and I use the 'addctrls' method to move them within a panel, do they retain their databoundedness and their relationship with the rest of the form?
I have a form that has all the databound controls I require already on it. I now have a requirement where, based on a condition set on the form, I may want to replace those controls by embedding an entire other window into the form.
I want to know if I can just leave the panel on the form and switch between the existing controls and the other window as the condition changes. If I can't retain the data binding, then I expect I would need to create a third window containing the controls and just switch between the two windows.
The second approach might be neater but based on the starting point would probably be more work.
Open to suggestions.
Comments
The answer to the first question is easy: yes, databinding is retained. The SRP Panel control was created originally to satisfy a requirement for a project that needed to display several databound controls within a scrollable panel. We were emulating a form that was originally written in Java - which can do this easily (as well as most other development platforms...only OI seems to have an issue with this. :-) )
With regard to your more complex scenario - switching between controls already on the form and controls coming from another form - I have never tried that so I cannot say with certainty what you should expect. I know that you can expect everything to work fine if you were doing one or the other, including the databinding, so I would expect that you should be able to alternate on-the-fly. However, you may also run into unexpected bugs.
I started with switching visibility of the original controls and the panel with the embedded form but whenever I made the panel invisible and the original controls visible, parts of the embedded form still bled through the visible controls.
Hence I want to leave the panel visible and just try switching the contents.
Hopefully the 'removed' controls won't bleed through the embedded form and if the data binding remains then I'm a lot further down the correct path.
Thanks for your input.