[Gambas-user] Miscellaneous routines for text box validation

Richard richard.j.walker at ...247...
Wed Feb 13 21:46:14 CET 2008


On Friday 08 February 2008 03:39:07 richard terry wrote:
> Hi all,
>
> My gambas learning project is progressing well (a contacts database
> manager), and I've got the point I can create new people/names/address(es),
> etc, now have to fine tune the gui, so not wanting to re-invent the wheel,
> I wondered if anyone had in their possession, or pointers to it, code which
> would do stuff like.
>
> for textboxes:
>
> Autocapitalise, or autocaps
> Date validation routines/formatting routines
> Name auto capitalisation eg for McBeth, or O'Neil etc
>
> Also In VB  in the textbox routines one had (index, keyascii) and one could
> manipulate the keyascii value to whatever to either exclude keys or
> autocapitalise things etc
>
> I wondered how this worked in gambas, as though I can detect the keypress,
> I couldnt see a way to send back a changed key value to the textbox.
>
> Thanks in anticipation.
>
>
> Richard
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

Hi Richard,
I did some name and address processing for a data capture post-processing 
program at work last year which involved processing UK postcodes and Mc, Mac 
and O' surnames. The problem I had to solve for the surnames was to present 
them in a uniform format as specified by the customer. 

I had to be able to take whatever style the operator had used and convert it 
to whatever the customer expected. The method I chose was to convert all name 
fields to title case and then search for the "Mc", "Mac" and "O'" patterns so 
I could capitalise the next letter.

That was usually all I needed to do for "Mc" and "O'" as these are quite 
unique patterns at the beginning of names. The case for "Mac" was complicated 
by the possibility of a word not being a Scottish name; Macey, Mackie and 
Macclesfield spring to mind. I handled these using a lookup list in an array. 
The list should contain all words you don't want to convert, like those three 
and maybe a dozen others.

In Gambas there is no title case function for a string. Just parse out the 
words using your own white space character list to determine the word breaks 
and then set the first character of each word to upper case. Now you have me 
interested in it again I think I'll try a Gambas translation.

Richard




More information about the User mailing list