Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highlight Mandatory/In focus fields
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00250575
Message ID:
00250580
Views:
14
Hi Gerard.

> I want to be able to highlight Mandatory and current field in focus,in some way, maybe using colours... but if a field is mandatory and has focus.. waht do i fo.. maybe use some other criteria.
>Also, How would I go about doing this.
>
The easiest way to do this is to add a property to your text box class. If you only want to deal with mandatory fields, you could make it a logical flag. But a more flexible way would be to add a 'cmode' property to your text box class that you could use in the instance to indicate mandatory, optional, read-only, etc. And you could display all of them in a different color all the time, not only when the text box has focus just bu putting some code in the text box class's refresh method like so:
WITH THIS
   DO CASE
      CASE .cMode = 'O'  && Optional
           .BackColor = RGB( 255, 255, 255 )  && White
	   .ForeColor = RGB( 0,0,0 )          && Black
      CASE .cMode = 'M'  && Mandatory
	   .BackColor = RGB( 255,0,0 )    && Red
	   .ForeColor = RGB( 0,0,0 )      && Black
      CASE .cMode = 'R'  && Read Only
 	   .Enabled = .F.
      OTHERWISE		&& Default to Optional
	   .BackColor = RGB( 255, 255, 255 )  && White
	   .ForeColor = RGB( 0,0,0 )  && Black
   ENDCASE
ENDWITH
If you only want to flag mandatory fields and only want them a different color when they have focus, then put the code to do so in the text box's GotFocus method.

Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform