[Glade-users] Custom entry box

Damon Chaplin damon@ximian.com
Sat, 03 Mar 2001 01:49:18 +0000


Martin Edlman wrote:
> 
> Hello,
> 
>         one question which I know is GTK+ related, but I suppose someone here
> would know the answer.
>         Is there some custom entry box, where it is possible to specify format
> of the entered text? e.g when I want entry where only numbers can be
> entered I specify the mask 00009999 (where 0 is optional number, 9 is
> requred number, so in this example at least 1000 must be entered), or if
> I want mask for an IP address i use mask 009.009.009.009, date
> 9999-09-09, time 99:99:99 and so on. Not only numbers can be specified
> by mask, letters can be specifed as well, special characters, ...
> There was (and I supose that it is still) similar widget (class) in
> Delphi, I was realy cool. Now I'm designing an application in Glade,
> where lot of IP addresses, dates and other fix format fields will be
> used, so it would be great if I can use some inteligent entry box.

There isn't anything like this at present.
I've been sent a patch which does something quite similar - it adds "Numeric"
and "Upper Case" options to GtkEntry in Glade. Thes ignore non-numeric
characters and convert to upper case respectively.

I'm not sure if we should add something like this to Glade, or if we should
wait for it to be added to GTK+.

A few issues:

 o What should happen when an invalid character is entered? Is it silently
   ignored or should a dialog pop up saying "The format should be 'xxxx'"

 o If you sete the mask to 9999-09-09 how would it be displayed initially?
   Would it show "    -  -  ", and then let you type over it. (This would
   need changes to the way GtkEntry works.) Or is the user expected to type
   in the '-' characters. This would be too difficult for the user.

I'm a bit unsure of adding it to Glade, since if GTK+ includes such a feature
in future it could well be slightly different.

Damon