I have been reading the discussions about whether or not Containers should have got/lost focus events. They so in fact have them but they dont seem to work. I have tried lots of different settings but I cnt get the LostFocus to fire for my containers.
This is the challenge.
I have a container with the bulk of my edit fields, an associated class to hold all the data and have various display/data related methods (DisplayRefresh, Get Data, SaveData etc).
I set the Container.Changed boolean when a control in the container changes. That in turn raises the Container.ContentsChanged event in which I set a container public property “IsDirty”.
So I know from ‘outside’ the container if the data has changed.
But my problem is, how do I ‘trap’ when the user leaves the container? I know if the data needs saving from the ‘IsDirty’ property, and I can save it away no problem.
But there are many different ways the user could ‘leave’ the container and there does not seem to be an event that the container will raise to say it is being left.
Instead it seems I have to put the same checking code in every possible route that the user could leave the container (Search for an other record, go to another record, close the app, got to a different section of the app etc etc etc).
Now if the container.lostfocus worked…
Any ideas pls???