Accepting input into editbox...

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Rayoom
Just popping in
Just popping in
Posts: 11
Joined: Sat Apr 30, 2005 03:27
Contact:

Accepting input into editbox...

Postby Rayoom » Wed Jul 13, 2005 20:55

I would like the user to only be able to enter alphanumeric characters into my editbox.

There is a function called Editbox::setValidationString(), I'm not sure exactly what this does, but perhaps it is what I am looking for?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Accepting input into editbox...

Postby lindquist » Wed Jul 13, 2005 21:11

that function allows you to set a regular expression to be used for validating the user-entered text.

This means that you can practically do any kind of validation you wish. Given that you know regular expressions.

In your case, you can do it like this:

Code: Select all

editbox->setValidationString("[0-9a-zA-Z]*");

User avatar
Rayoom
Just popping in
Just popping in
Posts: 11
Joined: Sat Apr 30, 2005 03:27
Contact:

Re: Accepting input into editbox...

Postby Rayoom » Wed Jul 13, 2005 21:16

Thank you lindquist for the quick response. Since I'm not familair with regular expressions (but I can figure out what 0-9a-zA-z are ;)) what is the '*' for?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Accepting input into editbox...

Postby lindquist » Wed Jul 13, 2005 21:32

I have a tendency to forget the details of regualar expressions very fast. But a page I usually use when in doubt is this: http://virtual.park.uga.edu/humcomp/perl/regex2a.html

the star * means that the character just to its left may be repeated any number of times (including zero).


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 10 guests