INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Forms & Screen

Give required fields a different background color by jimoo
Posted: 2 Apr 04 (Edited 5 Apr 04)

Objective:  On a form รป display the required fields with a different background color so the user can easily determine the required fields.

This assumes you have a textbox as part of your library that you sub-classed.  

1. Add a property on the textbox and name it: required
2. Add the following code in the refresh Method of the textbox:

IF Thisform.EditMode
   IF This.Required
      This.Backcolor = 8454143    && Yellow Background
   ELSE
      This.Backcolor = 16777215    && White Background
   ENDIF
ENDIF

If you do not use the Edit-Mode methodology, remove the First IF statement of the nested-if.  It is the THIS.REQUIRED piece of logic that is most important.

Tip: If you are not sure of the number value for the color, type the following in the command line and pick the color with your mouse:

? getcolor()


To test this.  Drop 4 or 5 text fields on a form and set a couple of the required properties to .T.  Execute the form.




Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close