Re: [ANNOUNCE] gtk+widgexts-0.0.3 beta released



On Thu, 2002-01-03 at 02:32, Santiago Capel wrote:
> ***
> *** gtkwidgexts::GtkxEntryMask
> 
> GtkxEntryMask is a widget based upon the GtkEntry widget, which extends
> adding a type to the text.
> Once the type is set, the widget only allows valid characters to be
> typed.
> These are the main features:
> 
> - The supported types are:
>  - STRING
>  - NUMBER
>  - CURRENCY
>  - DATE
>  - TIME
>  - DATETIME
> 
> - The mask property states which characters are valid. For example:
> 
> type=STRING, mask="AA-99"

Your mask seems to be quite limited, I'd suggest to use regular
expressions here. You never know what restrictions we in our sheer
madness^W^Winfinite wisdom want to impose on our users.

> The first two characters MUST be alphanumeric, the third character MUST
> be a hyphen and the last two charactres MUST be numbers. The maximun
> length of the string is 5.

Hmm, what if the string needs to be exactly 5 characters long? My best
idea is to have a set of allowed characters which can be typed in
('[A-Za-z0-9]' or somesuch) and a regular expression on which the string
will be tested afterwards ('^[A-Za-z0-9]{2}-[A-Za-z0-9]{2}$'). Yes,
regular expressions are hard to write and even harder to read, but they
are most flexible, which is a big bonus in my eyes.

Nils
-- 
Nils Philippsen / nils fht-esslingen de / nils redhat de
Ever noticed that common sense isn't really all that common?
PGP fingerprint:  C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011

Attachment: pgpIpVNDp6mND.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]