Home » U++ Library support » LineEdit, EditFields, DocEdit » filtering characters in the EditString [SOLVED...]
filtering characters in the EditString [SOLVED...] [message #2504] |
Sat, 15 April 2006 20:31  |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I miss a feature that I believe it is very useful (maybe it is already present and I was unable to recognize it).
The EditString widget permit to enter a string but sometimes could be useful to prevent the user from entering useseless or dangerous characters. For example if I ask in input a name I would like to prevent the insertion of characters like: ',' '.' ':' ... '1' '2' etc ...
I think could be useful a new method like:
FilterEdit( ",.';" );
where the characters inside the string "..." are not permitted.
Maybe could be useful even some more method to restrict the string input. For example one that convert automatically the entered string in upper case (lower case). One that accept only alphanumeric avoiding all other characters: []()',. etc...
Thank you,
Luigi
[Updated on: Mon, 17 April 2006 05:09] by Moderator Report message to a moderator
|
|
|
Re: filtering characters in the EditString [message #2509 is a reply to message #2504] |
Sun, 16 April 2006 04:01   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
First of all, the topic was in a wrong category -theIDE. This is a library question.
Second thing, I suggest you to learn Ctrl_Shift_F for "spying" packages for examples of usages.(candidate No1- ...ide ) Double click on console result brings you to the appropriate file.
If you can't find anything usefull then ask if it exists (maybe under a different name).
If you find something similar try to check if this is just very easy to adapt to your case.
But when I did spying for you with "Filter", I've found that there is StrUtil.cpp with some similar functions.
e.g
D:\Devel_upp\uppsrc\ide\idewin.cpp(729): ide.mainconfigparam = Filter(~arg[i] + 1, CommaSpace);
then jumping with "Go to derfinition" from CommaSpace,
ide brought me to idewin.cpp
int CommaSpace(int c)
{
return c == ',' ? ' ' : c;
}
Maybe you can use them easily?
Edit: If not, show why not and apply on library wishlist...
[Updated on: Sun, 16 April 2006 04:05] Report message to a moderator
|
|
|
|
Re: filtering characters in the EditString [message #2511 is a reply to message #2510] |
Sun, 16 April 2006 04:36   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
below your let's say Avail3
#include "VegaMain.h"
void Avail3(One<Ctrl>& ctrl)
{
// ctrl.Create<Option>().ThreeState();
ctrl.Create<OptionImage>().ThreeState().SetImage(imgYes(), imgNo(), imgMaybe());
}
int FilterCommaSpace(int c)
{
if (c == ',' || c ==' ') return false; //add more unwanted chars here..
else return c;
}
...
...
void VegaTab1::MaskDefaultValue() // body of the callback
{
editName <<= Null;
editName.SetFilter(FilterCommaSpace); //added filter
...
Edit: It looks like you even didn't spy EditString! ...
[Updated on: Sun, 16 April 2006 04:39] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 20:27:53 CEST 2025
Total time taken to generate the page: 0.00936 seconds
|