Re: Power Objects: Enforcing Constrains During User Edit of Fields
Date: 1996/07/02
Message-ID: <Randy-0207961834560001_at_news.earthlink.net>#1/1
In article <31CC2FC0.146D_at_interaccess.com>, Rick Greenwald <greenie_at_interaccess.com> wrote:
> Randall Gellens wrote:
> >
> > How do 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.
> You might want to look at the example for hiding a password at
> www.inquiry.com for more information in using the OnKey() method, which
> should work.
Thanks for the suggestion. I looked at the FAQ (it has really been spiffed up since I last visited), and the technique for password hiding seems, well, kind of klugy. I guess it would be OK for passwords, which are typically short, and which users don't expect to be able to see as they type anyway. But for general data fields, I don't think it would really be that good an idea. Say the user wants to fix the spelling of a proper noun. It would be very reasonable to use the mouse to select some characters, delete them, and insert the correct ones.
I wonder if there is any way to force LEN ( SELF.VALUE ) to get updated during user edit?
> Lots of other new stuff too.
Yes, the new OPO stuff at www.inquiry.com is really neat. Thanks very much for making it available.
-- Randy Gellens "I speak for myself alone" Randy_at_Pensive.OrgReceived on Tue Jul 02 1996 - 00:00:00 CEST