Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Give required fields a different background color

Forms & Screen

Give required fields a different background color

by  jimoo  Posted    (Edited  )
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.



Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top