Am 1 Mar 2007 11:16:55 -0800 schrieb David C:
That is what I was hoping to avoid for the sake of maintainability as
well as my sanity.....having to write an event for each element, and
since each element fires a different event when gets "dirty," I'd have
to take all those things into consideration.
TextBoxes and Combos are pretty simple, but then I have some third
party controls as well.
C'mon! Its not so difficult. For example, in the Controller you can make a
function to iterate over all controls in the form. For each control you
determine the type and hook up the appropriate event that signals a state
change. Of course, all these event handlers are in the Controller class and
simply set dirty member of the controller to true.
Yes, there are different if-the-else for Comboboxes, Textboxes, Checkboxes
etc. And if your custom controls provide any means to signal a data change,
put the needed code to set up the event wiring in another else-if-part.
As I said: tedious, yes, but you have to do it only once for all software
you'll ever write.
A slightly more professional version would have adapter classes for each
control. Advantage is that you can intercept when certain things happen.
Just derive a special adapter..
One also can derive from the controls and make them implement an
appropriate interface. The controller then deals in terms of the interface
only.
I also looked into data binding, which I found was not useable for larger
apps.
My 2 cents
Paule