Hi,
using the masked textbox , is it possible to use a mask that would allow only ascii characters as input?
if so can you help me with mask please.
Thanks
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Shivangi,
I believe that you can use the RegEx mask (Mask Type: Full Functional Regular Expressions ) with "\x20" characters to accomplish this task. Please try this solution and let us know the results.
Thanks,
Andrew
Hi,
I am looking for WPF/SilverLight editors , they dont have a mask as Full Functional Regular expression.
There is only regex available.
Will that work? can you give me the mask to be used if possible.
Thanks
Hello,
Thank you for the feedback. We use the same MaskManager for all editors in the WinForms/SL/WPF platforms. Thus, the solution suggested for WinForms will work for WPF/SL too. In your case, use the \x20 value for the Mask to represent the ASCII character.
Thank you, Marina
Hi Marina
I tried using \x20 for the mask value but it doesnt work…
infact it doesnt let me enter anything …its just stuck …can you please help me.
Thanks
Hi Shivangi,
It appears that our previous answers were unclear. Let me apologize for that.
The "\x20" mask represents the single ASCII character (the "space" in this example). If I correctly understand your objective, I suggest that you use the following mask instead:
<dxe:TextEdit HorizontalAlignment="Left" Margin="178,26,0,0" Name="textEdit1" VerticalAlignment="Top" Width="150" MaskType="RegEx" Mask="[ -~]*" />
Please let me know how this solution works for you.
Thanks,
Vito
Hi Vito,
Thanks a lot.
It helped me a lot.
Thanks once again.
You are welcome!
Thanks,
Vito
Hi Vito,
revisiting tihs issue gain.
I did use the mask you gave me for ascii characters and it works well meaning it doesnt let me enter the ascii character but if there is ascii character in my database it shows up on the textbox but when i try to edit it it disappers meaning as soon as i get focus on the textbox it diappers but if i dont edit it and jus come out of that box it shows it again.
Can you help me on this I jus dont want it to populate even if my database has it previously .
Thanks
Shivangi
Hi Shivangi,
The behavior you described is unusual, and I have no clear idea on why this may happen. Would you please provide a small sample project, where the problem is reproduced, so that we can examine it?
Thanks,
Vito
Hi Vito,
Please find the attached demo project.
In the project on the 2nd TextEdit control I have given the mask for ascii character as follows
MaskType="RegEx" Mask="[ -~]*"
Now in the form load event I have given ascii charater to the textbox.text value , and so when the project loads and you complie you will see the text as shivangi©shah and now if you take the mouse over to that text box and click on it it will remove the ascii character © .
but if you dont type and click on the 1st textedit control you will see the ascii chracter back but if you type something in the textbox with the ascii character then it removes it evn ig you leav that control and move to any control.
Can you help me on this.
Thanks
Shivangi
Hi Shivangi,
The problem is that the "[ -~]*" mask does not include the "©" character. It is outside this diapason. I suggest that you refer to the following page to learn where it is located in the ASCII table:
The ASCII code 184
To address the problem, simply extend the mask to include this character. Use the "[ -©]*" mask instead.
Thanks,
Vito
Hi Vito,
It's working opposite of what i expected.
If i use "[ -©]*" then the character © is allowed in the textedit box meaning i can enter © and also it does not remove it like it used to earlier.
Thanks
Shivangi
Hi Shivangi,
I do not quite understand how you want the editor to work in this case. Would you please describe the expected behavior in greater detail?
Thanks,
Vito
Hi,
Please find the attached project
I have 4 things to ask , please refer the attched demo project for the same.
This happens when on load i send a value to the textbox and then click on edit button and change it and move to some other textbox the mask is also removed, but if i dont send value on load and click edit it works fine but i require the former functionality how an i achieve it?
How can i make it behave same as SSN
"Shivangi©shah€" to the text box so on load it shows up whole word as i passed but when i try to edit it removes "©" and "€" and if i dont type anything and move to another control it puts them back but if type something those two ascii characters are gone.
also it doesnt let reenter them which good and that is what i want. but what i am also looking for is if the mask is ascii then it should not display it at all in the first place even if i am sending it on load …is it posiible to do so? if so how?
I can do that on my 1st dateedit control not on th esecond i dont what is the difference between them , they are exactly same yet behave different , only difference is their range.
Please help me on this issues. We are really lagging our deadlines , I would really appreciate if these can all be answered as soon as possible.
Thanks
Shivangi
Hi Shivangi,
Thank you for your response and providing the modified sample project.
I see all the problems you described, but I cannot currently tell you how to address them. We need some time to examine them in detail. Your patience is greatly appreciated!
Thanks,
Vito
Hi Vito,
Thanks for looking into it. I will wait for the solution.
Thanks
Shivangi
Hi Shivangi,
Here are our comments on your questions.
>>>>>
This happens when on load i send a value to the textbox and then click on edit button and change it and move to some other textbox the mask is also removed, but if i dont send value on load and click edit it works fine but i require the former functionality how an i achieve it?
<<<<<
Activate the MaskUseAsDisplayFormat option for these editors. This way, the same format will be applied no matter if the editor is in "edit" state or not.
>>>>>
How can i make it behave same as SSN
<<<<<
If I correctly understand the situation, I suggest that you activate the ValidateOnTextInput option.
>>>>>
"Shivangi©shah€" to the text box so on load it shows up whole word as i passed but when i try to edit it removes "©" and "€" and if i dont type anything and move to another control it puts them back but if type something those two ascii characters are gone.
also it doesnt let reenter them which good and that is what i want. but what i am also looking for is if the mask is ascii then it should not display it at all in the first place even if i am sending it on load …is it posiible to do so? if so how?
<<<<<
Activate the MaskUseAsDisplayFormat option for this editor as well. In this situation, the editor's Mask will be applied when the editor is in a "browse" mode, and thus characters that are not allowed will not be displayed.
>>>>>
I can do that on my 1st dateedit control not on th esecond i dont what is the difference between them , they are exactly same yet behave different , only difference is their range.
<<<<<
The problem is that the current Date is used by default as the editor's DateTime value. This value is out of the range you specified via the MinValue/MaxValue properties, and thus the "out of range" error is shown. It appears that the only solution we can suggest is not to set the MinValue/MaxValue properties, but handle the Validate event to check whether a value is valid or not. Another solution is to activate the AllowRoundOutOfRangeValue option. However, in this instance the editor's value will be automatically set to MinValue or MaxValue.
I am attaching a modified project, containing the changes I described. Please try it and let us know how it goes.
Thanks,
Vito
Hi,
Thanks Vito.
Thanks
Shivangi.
You are welcome!
Thanks,
Vito
Hi Vito,
>>>>>
2. I have a dateedit control, when i enter the date unless i click enter or any arrow key or move out of the control the validation symbol doesnt show up like it does in SSN , In the SSN field as soon as i start typing the validation sysmbol comes up and upon the last digit it goes off but in case of dateedit behaviour is not same , it doesnt show even if enter whole date unless i click any other key and similarly it doesnt go off after entering the correct value unless i click enter or space or any arrow key or move to some other control.
How can i make it behave same as SSN
<<<<<
If I correctly understand the situation, I suggest that you activate the ValidateOnTextInput option.
>>>>>
this is still a problem. Even after ValidateOnTextInput option is set to true, while typing date in, the month,day,year gets highlighted as we type and lastly year is highlighted so unless i move out as mentioned earlier by using arrow or any or key it does not bring the validation message or removes the validation message.
You can use the same code , the one you sent me earlier for dubugging it.
Please can ths issue be solved?
Thanks
Shivangi
Hi Shivangi,
I do not quite understand the problem you are talking about. To help us better understand it, would you please provide us with a screencast, illustrating the issue in action, and describe in as much detail as possible what behavior you expect to see?
Thanks,
Vito
Hi Vito,
What i want is…, like SSN, once you type in the last digit the validation "X" sign goes off but in case of date it doesnt.
in dateedit ,Even after you finish typing if its out of range it doesnt bring up the "X" validation sign or nor does it remove immediately after yoy finish typing the correct value unless you hit any other key like "arrow button, space or enter key"
I have attcahed pictures for both scenarios.
I am sorry but i dont know how much detailed than this i can explain.
Thanks
Shivangi
Hi Shivangi,
Thank you for your response and providing the additional explanation.
I now understand what functionality you wish to see, and I suggest that you set the editor's MaskType property value to "DateTimeAdvancingCaret" and enable the ValidateOnTextInput option:
<dxe:DateEdit Width="150" Margin="10" Name="dt1" MaxValue="{x:Static Member=sys:DateTime.Now}" MinValue ="1/1/1910" DisplayFormatString="d" ValidateOnTextInput="True" MaskType="DateTimeAdvancingCaret"> <dxe:DateEdit.ErrorToolTipContentTemplate> <DataTemplate> <TextBlock x:Name="txtmsg"> <TextBlock.Text> <MultiBinding Converter="{StaticResource ErrorTooltipTextConverter}"> <Binding Path="MinValue" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=dxe:DateEdit}"/> <Binding Path="MaxValue" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=dxe:DateEdit}"/> </MultiBinding> </TextBlock.Text> </TextBlock> </DataTemplate> </dxe:DateEdit.ErrorToolTipContentTemplate> </dxe:DateEdit>
This way, the cursor will automatically jump to the next part of a date once you finish typing, which will force validation.
Thanks,
Vito
Hi Vito,
Thank you very much!!!
Its really helped!!!
Thanks
Shivangi
I am glad to hear that this helped!
Thanks,
Vito