The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
SYMPTOMS
When a check box variable is based on a table field instead of a memory
variable, the check box initially appears as disabled if the table is
opened as SHARED.
CAUSE
The check box @...GET is executed before the record is locked.
WORKAROUND
Use either of the following workarounds to enable any check box:
- Execute =RLOCK() in the screen setup code. If the table is opened by
the screen with the Open Files generated code option or opened in the
screen setup code, the =RLOCK() must follow the opening of the table.
-or-
- Issue either a SHOW GETS or SHOW GETS <field name> command for each
check box field in the On Window Activate code.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
MORE INFORMATION
Steps to Reproduce Problem
- Create a table called CHKTEST.DBF with a character field named char1 and
a logical field named log1. Add a few records.
- Create a screen from this table and place a field from char1 and a check
box from log1 (these should be from the fields, not memory variables).
The check box should not be the first object.
- Generate the screen and name it CHKTEST.SCX.
- Close CHKTEST.DBF then run the USE CHKTEST.DBF SHARED command.
- Issue the DO CHKTEST.SPR command.
- The check box is disabled. You can't click it with the mouse, but
it will behave correctly after you move to it by pressing the TAB key.
General Notes
- The check box @...GET is executed prior to the locking of the record
when the READ is issued. The record will be locked when the READ is
issued unless READ NOLOCK has been specified as a Generated Code Option.
- Issuing a =RLOCK() command prior to the check box @...GET being executed
will lock the record and allow the check box to be properly accessed.
This must occur after the table has been opened -- not in #SECTION1 of
the Setup snippet.
- Issuing a SHOW GETS or more specifically a SHOW GET <field name> for
each check box field will suffice. Placing this code into the On Window
Activate snippet will cause the check box to be enabled upon running the
screen.
- If the table is opened as EXCLUSIVE, or the check box is the first
object on the screen, the check box will always appear enabled.
|