or instead of subclassing the container - some simplicity just add the property LastObject to the form!
Main Topics
Browse All TopicsI have a container in my form contain 10 text objects, i programed on lost event of the container that if certain validation has not been fullfilled then user cannot leave the container like ;
in lostfocus event of the container;
if ! my_condition
thisform.contrainer1.setfo
endif
its working fine. now my question is whenever above condition fired, it setfocus on first object of the container. I want that if user was on object 3 and lost focus of the container then the lost event should not allow to leave the container and remain focus on object where user was last exist.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
actually I want to do this thing logiacally, therefore I can easily use this in my project as a generic procedure. Hardcode every valid event is not a practicle way.
your second sugestion is not bad, but i still need to hardcode every gotfocus event of the control for the purpose.
what is your opinun, am I right ?
I cant think of any other way than this, unless your application is working with a subclassed form as you main forms, then you may be able to add an Assign method the the forms Activecontrol property.
When the Assign method is called you can update your LastObject property with the Activecontrol (if the activecontrol is not empty)
You cant use the forms activecontrol as it is because when you change focus the Activecontrol property gets set to null. so using the assign method will allow you to control your own version of ActiveControl.
You can then use the method I stated above on the containers lostfocus event.
Hope this makes sense. Theres probably a much easier way to do this but at the moment I can't see the wood for the trees!
AH
Business Accounts
Answer for Membership
by: ah7386Posted on 2003-06-13 at 02:58:35ID: 8716157
You can either use the valid event of each control in the container - this is the easiest way, or....
O"
subclass the container and add a property such as
LastObject
in the gotfocus event of each control in the container you can then put
this.parent.lastobject = this
on the lostfocus of the container you can then use
if type("this.lastobject")=="
&& check for valid and then reset focus
this.lastobject.setfocus
endif