Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabling a Key Press
Message
 
To
14/12/1999 14:26:36
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00303395
Message ID:
00303617
Views:
12
Michael,

>I know this is an insignificant difference, but wouldn't it be less code to StrTr(this.value,"-","") in LostFocus than to prevent the key from being entered? (unless i guess if you set the maxchars (to 9 for SocSecNo), where the "-" would be counting towards that maximum)

In my opinion it is better to let the user know what is ahppening as soon as possible rahter than make a magical change to their work after the fact. Users can get disturbed by the strangest things. I expect that some users would be set back by a textbox that magically changed what they had entered on them.

>BTW, do you have a list of 'bad' commands and their accompanying severe and devastating side effects - it would be an invaluable reference for the future.

I don't know of any "bad" commands in VFP. There are a number of commands that are often misused adn wehn misused they can cause problems. A few pointers;

  • If the help file says "For backwards compatibility" read that as "Compatible with backwards" (thanks to Drew Speedie for that one)

  • ON KEY LABEL used for anything but interrupting running code (problem is the very nature of what makes this command useful in specific areas, it will interrupt running code and if that is not the required behavior it can interrupt code in unexpected places and cause bugs that are very difficult to track down because the user's answer to "What did you do before the error?" is always "Nothing!")

  • PUBLIC anything as they stomp on everything without any regard; calling UDF's from object methods (it causes code to run from inside an object that is outside the object's boundaries)

  • Primary keys that have meaning to the users (if it means something to the user they will want to change it)

    There are others but those are a good start.
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform