Data Access Worldwide Knowledge Base
Article ID 2328 Article Title INFO: OnSetFocus/OnKillFocus versus Entering/Exiting Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2328 KBase Category VDF (GENERAL) Date Created 06/15/2007 Last Edit Date 06/15/2007
Article Text
QUESTION:
I see that Visual DataFlex has the following events and I wonder what the differences are:
- OnSetFocus / Entering
- OnKillFocus / Exiting
ANSWER:
First of all the Exiting and Entering methods are much older than the OnKillFocus and OnSetFocus methods. The first two ones were defined in character mode OO DataFlex and the OnSetFocus / OnKillFocus were added in the VDF era.
The real difference is that OnKillFocus and OnSetFocus are called whenever the object loses or gets the Windows focus while Entering and Exiting are not always executed at the same time.
Exiting, for example, is never called when the object that gets the focus (or one of its parents) has its scope_state set to true. For example, if you open a selectionlist dialog (using the prompt button or the F4 key), the exiting method of the form is NOT called but the OnKillFocus is fired.
Exiting and Entering can also be used to stop navigation. When you conditionally do not want that an object is exited (for example, because the data is not correct), you can return a non-zero value from Exiting. If you would try to do the same with OnKillFocus, nothing happens.
Exiting also "knows" what object will get the focus next and passes its object id as parameter to the method.
If the object that is supposed to get the focus refuses the focus, for example because entering returns a non-zero value, the events OnKillFocus and OnSetFocus of the current object are never fired.
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.