Print Page | Close Window

Set not firing when tabbing through field

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1125
Printed Date: 27-Mar-2025 at 11:34pm


Topic: Set not firing when tabbing through field
Posted By: BrooksAdair
Subject: Set not firing when tabbing through field
Date Posted: 10-Mar-2009 at 8:36am
I have a field that is bound to a property that is mandatory depending on the value of other properties. I have a verifier attached to the property that determines when it should be mandatory.  The verifier works fine, but when the user tabs through the field without hitting a key, the setter is never called. If the user hits space, then back spaces, then tabs it will call the setter and the verifier will stop the user as needed.

How can I get the setter to always fire, even when the user makes no changes?



Replies:
Posted By: kimj
Date Posted: 13-Mar-2009 at 8:03pm
Your best bet is to use an instance verifier instead of, or in addition to, the property level verification you're already doing.  When verification of a property is dependent on the values of other properties instance-level verification of the entire entity is usually preferable.
 
As for how to force the setter to fire, I really don't know.  The default DataSourceUpdateMode of the BindingDescriptors is "OnValidation", which means a change has to be made and the control exited before the setter is called.  The "OnPropertyChanged" mode, when set, means that any change typed into the control causes the setter to be called.  But there's no mode available to call the setter just when tabbing through.  You'd probably need to hook into control or form events to do something programmatically.  But, instance verification would probably be a much cleaner and easier approach.


Posted By: BrooksAdair
Date Posted: 16-Mar-2009 at 11:43am
Thanks for the information. I have instance verification in place already, but due to the flow of the screen I still need the property level verification to always fire. I will try directly calling verification for the property on the Leave event and see if that works.  



Print Page | Close Window