I have a method that I wrote that sets the background color of all empty form fields to pale yellow. That way, at a glance, the user knows what fields remain to be filled. After the user fills the field its background color changes to white. The method is called Setbackcolor as seen below and runs whenever I do a form Init or change to another record by pressing Top, Bottom, Prev, Next. The problem is that if the RowSource is not Value, but is Array or Fields instead, the background color does not change to white. The background color changes to gray behind the characters only and stays pale yellow background in the rest of the form field. I apologize for the wrapped-around command lines below. I think you can still follow what I am doing.
LOCAL loRef, ii
loRef = THISFORM
FOR ii = 1 TO loRef.ControlCount
DO CASE
CASE loRef.Controls(ii).BaseClass = "Textbox"
loRef.Controls(ii).BackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
loRef.Controls(ii).DisabledBackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
CASE loRef.Controls(ii).BaseClass = "Editbox"
loRef.Controls(ii).BackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
loRef.Controls(ii).DisabledBackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
CASE loRef.Controls(ii).BaseClass = "Combobox"
loRef.Controls(ii).BackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
loRef.Controls(ii).DisabledBackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
CASE loRef.Controls(ii).BaseClass = "Checkbox"
loRef.Controls(ii).BackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
loRef.Controls(ii).DisabledBackColor = ;
IIF(EMPTY(loRef.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
ENDCASE
NEXT
Then inside of each form field I have the following code in the Interactive Change event. This code changes the background color from pale yellow to white whenever the user enters a value into the form field:
THIS.BackColor = IIF(EMPTY(THIS.Value), ;
RGB(255,255,128),RGB(255,255,255))
THIS.DisabledBackColor = IIF(EMPTY(THIS.Value), ;
RGB(255,255,128),RGB(255,255,255))
How come Array and Fields-based comboboxes background colors behave differently than Value-based comboboxes? This does not compute! I don't see the problem. Do you? Please help. Thanks.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site:
www.stephenkramer.comWould you believe Far Side Lite?
More than 270 original cartoons.