Power Objects: Enforcing Constrains During User Edit of Fields

From: Randall Gellens <Randy_at_Pensive.Org>
Date: 1996/06/19
Message-ID: <Randy-1906962142040001_at_news.earthlink.net>#1/1


How to people enforce field constrants during user edit?

For example, if a field can only contain numbers, it would be nice for letter and symbol keys to not work. Or if a field has a maximum length, it would be nice for ASCII keys to stop working when the maximum length is reached (but delete and backspace, for example, would still work).

The alternative seems to be to put code in Validate(), but that doesn't happen until the user leaves the field. So they get an annoying error message and have to go back and fix it. I think it's nicer to have it be checked while in the field.

I tried adding code to OnKey, and something like "If LEN ( Self.Value ) = Self.DataSize AND KeyCode = 0" seems to work, except that the length isn't updated as the user types. It only seems to get updated when the user leaves the field.

Any ideas?

-- 
Randy Gellens                               "I speak for myself alone"                             Randy_at_Pensive.Org
Received on Wed Jun 19 1996 - 00:00:00 CEST

Original text of this message