The information in this article applies to:
- Microsoft Visual FoxPro for Windows, versions 3.0 and 3.0b
SYMPTOMS
It is possible to set the DisabledForeColor of some objects generically,
rather than using an explicit value. One way to do so is to set the
DisabledForeColor property to =This.ForeColor to make the DisabledForeColor
of most objects identical to the current ForeColor. However, this has no
effect on check boxes or on combo boxes that have a Style property of
2-DropDown List.
WORKAROUND
Combo Box Objects
- Set the Style property of the combo box to 0-Dropdown Combo.
- Set the DisabledForeColor property of the ComboBox to:
=THIS.FORECOLOR
- To make the combo box behave as if its Style property were 2-Dropdown
List while enabled, place the following code in the KeyPress Event of
the combo box:
NODEFAULT
Now the combo box will behave as if its Style property were 2-Dropdown List
with a DisabledForeColor identical to the ForeColor.
Check Box Objects
- When you disable objects on the form, do not disable any check boxes.
- Create a Custom property of the form to indicate whether objects are
enabled or disabled that is called, for example, IsEnabled. Set this
property to false (.F.) if the objects are to be initially disabled or
true (.T.) if the objects are to be initially enabled.
- In the GotFocus and MouseUp events of the check box(es), place the
following code:
IF !THISFORM.IsEnabled
NODEFAULT
ENDIF
Now the check box always has the same ForeColor but can be disabled by
changing a custom property on the form such as IsEnabled to false.
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new form, and place a combo box and check box on the form.
- Set the combo box Style property to 2-Dropdown List, the RowSourceType
property to 1-Value, and the RowSource property to "One, Two, Three,
Four, Five"
- Set the DisabledForeColor property of both the combo box and the check
box to =This.ForeColor.
- Place a command button on the form. Give it a caption of Disable, and
place the following code in its Click event:
WITH THISFORM
.combo1.ENABLED =.f.
.check1.ENABLED =.f.
ENDWITH
THISFORM.REFRESH
- Run the form, click the combo box, and choose an item from the list.
Click the Disable button. Note that the check box and the combo box text
is not the same as the ForeColor when these objects are enabled.
|