[Lazarus] is the website down?
John Meyer
john.l.meyer at gmail.com
Mon Jul 21 01:37:09 CEST 2008
Hi Howard,
you said:
"I wasn't able to tell that the DisplayFormat property of dbgrid did
anything at all. Is this documented anywhere?
And apparently, there is no EditFormat property at all. What I want to
do is some rudimentary validation, e.g., make sure a zipcode is exacty
five characters long and all characters are digits. How do I do that in
a Lazarus/FPC dbgrid?"
you could use a try...except block to attempt to convert the number to
an integer, this would tell if it is wrong, length could be achieved
with length(inputstring) , it should also work with UTF-8 as numbers are
a single byte subset of the UTF-8 encoding system, I wouldnt like to try
it for text length on non latin text though
Why limit yourself to zip codes though, an application should have a
more international appeal
A british postcode is like this B1 24NJ, CV21 3HB
If your using Zeos database components, specifically the table
component, the field events onGetText & OnSetText could be a good place
to do your checking
By having a mask field in the country table it should be possible to set
the country first then match the postcode, this is the approach I am taking
I have extensive lists in MySql on ZIP codes, countries, province/state,
cities etc. which I have no objection to sharing
I am also working on an address book project
Basically it is being designed with Lazarus 0.9.25 beta for the UTF-8
support
Database is MySql using Zeos database components
The address lists are being built to show address information in dual
language format, so China shows in English & Chinese, Israel in English
& Hebrew
The real kicker though is in connecting it over the net to exchange
non-personal address data with a central server
So if you enter the Hebrew translation for Tel-Aviv it will become
available to all other users worldwide
I already have Chinese provinces in Chinese!
Thanks to US policy I have fairly complete lists on US postcodes &
Cities but limited for other countries at the moment
I want to be able to print an envelope in 2 languages where appropriate
& I want to do it when I can't even read the other language
I intend to also create a set of components to let others use this
address book as a component within a project, for example accounts programs
I would of course welcome any help with this project
I personally dont intend to change from MySql as the database is already
shared with web design code, having said that, I would welcome the
ability to support differing database types within the application
You can find the lists of countries at
http://comchatter.com/nlso/geodata.php, it is part of a much larger
internationalization support project
More information about the Lazarus
mailing list