Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using the ValidateText method of UniversalTextBox

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
keesp
Guest





PostPosted: Wed Oct 05, 2005 12:47 pm    Post subject: using the ValidateText method of UniversalTextBox Reply with quote

Hi,

I am using the ValidateText method of UniversalTextBox, but am not very happy with the popup boxes that are shown. I would preferably carry out the validation, and if the result is false perform a CancelTextEntrry, while setting the foreground colour of the text in a different colour (or so).
Is there any way to achive this functionality? Does ValidateText perform an intelligent check, or is it quite simple to program? Is there any way to prevent the popup box from showing?

Thanks,

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Oct 05, 2005 11:29 pm    Post subject: Reply with quote

To handle exceptions that occur during Text->Value conversion yourself you can either handle the ValidateTextError event or override the OnValidateTextError method and set the Handled property to true (this will prevent the message box being shown).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
keesp
Guest





PostPosted: Thu Oct 06, 2005 8:15 am    Post subject: popup boxes Reply with quote

Hi,

Overriding the OnValidateTextError does *not* prevent the popup box from showing up. I am working with the following setting; overriding the following methods of universal edit box:

/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnLostFocus(EventArgs e)
{
if( this.ValidateText() == false )
this.CancelTextEntry();
this.FormatText();
base.OnLostFocus(e);
}

protected override void OnValidateTextError(Infralution.Controls.ValidateTextErrorEventArgs args)
{
//base.OnValidateTextError (args);
}

The OnLostFocus is used to store the entered text values when someone clicks the mouse on another position on virtual tree.

What happens is, that I now can leave the edit box and that the values are taken over, whether they are correct or not, but when I re-enter the edit box, suddenly the popup-box is shown (six times) before being able to edit again.

I have sent a zip file that demonstrates the problem.

Thanks

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Oct 06, 2005 12:24 pm    Post subject: Reply with quote

Just overriding OnValidateTextError is not enough - you must set the Handled property of the args parameter to true - eg

Code:

protected override void OnValidateTextError(Infralution.Controls.ValidateTextErrorEventArgs args)
{
   args.Handled = true;
}

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
keesp
Guest





PostPosted: Thu Oct 06, 2005 1:46 pm    Post subject: Works Fine! Thanks Reply with quote

See subject
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group