The information in this article applies to:
- Microsoft FoxPro for Windows, version 2.6
- Microsoft FoxPro for MS-DOS, version 2.6
SYMPTOMS
When used in a screen, OBJVAR() returns incorrect values for a current or
specified Screen object that has a preceding Push/Radio button object with
more than one prompt as following:
- A NULL value is returned if the current or specified Screen Object is
immediately preceeded by a Push/Radio button that has more than one
Prompt.
- The name of the memory variable, array element, or field associated with
the object Preceeding the current or specified object, if the
Current/Specified object and the Preceding Push/Radio button object have
one or more screen objects between them.
- If two radio buttons exist on a screen, a NULL value is returned by the
OBJVAR() function for objects past the 2nd radio button.
- The OBJVAR() function inconsistently returns a NULL for objects past
approximately 20 objects (other than radio buttons).
RESOLUTION
You can use one of the following methods to work around this situation:
- Do not use Radio or Push button objects with multiple prompts before or
after the object for which you do not want OBJVAR() to return a NULL.
Instead, create a separate Radio or Push Button object for each of the
prompt that needs to be defined.
- Use VARREAD() or SYS(18) functions instead of OBJVAR().
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new screen by using this command:
MODIFY SCREEN TEST.SCR
- Create a Push Button or a Radio Button object by using this program:
Type = Normal
Push/Radio Button Prompts = ONE; TWO
Variable = MOBJ1
Options = Horizontal/Vertical
Place the following code in the Valid clause:
DO CASE
CASE MOBJ1=1
WAIT WINDOW "ONE"
CASE MOBJ1=2
WAIT WINDOW "TWO"
ENDCASE
- Create a Field Object by using this code:
Input Field = GET
Input = MOBJ2
OPTIONS = Select Field on Entry
- Create another Push/Radio button similar to the one described in Step 2,
except use MOBJ3 as the variable name.
- Place the following code in the "Screen Setup Code" clause:
ON KEY LABEL ALT+O WAIT WINDOW "OBJVAR() = "+OBJVAR()
- Place "ON KEY" command in the "On Screen Exit (Valid)" clause.
- Generate the Screen, and run it using the RUN command.
- Select the First Push/Radio Button (1st Screen Object), and press ALT+O.
"OBJVAR() = MOBJ1" will be displayed in the wait window. So far OBJVAR()
is working correctly.
- Select The Get Field (2nd Screen Object). Then press ALT+O. Only
"OBJVAR() =" is displayed in the wait window. This means OBJVAR()
returned a NULL value. This step produces the first symptom.
- Select the second Push/Radio Button (3rd Screen Object), and press
ALT+O. This time "OBJVAR()= MOBJ2" will be displayed in the Wait Window
instead of "OBJVAR()= MOBJ3." This goes to prove that OBJVAR() is
returning the variable name for the previous object (2nd Screen Object)
instead of the current screen object (3rd Screen Object). This step
produces the second symptom.
- Exit the Screen. Then open it by using the "MODIFY SCREEN" command.
- Change the first Push/Radio Buton (1st Screen Object) by using this
code:
Type = Normal
Push/Radio Button Prompts = ONE
Variable = MOBJ1
Options = Horizontal/Vertical
Valid = WAIT WINDOW "ONE"
- Generate and run the Screen.
- Repeat steps 8 thru 10. Notice that OBJVAR() now returns correct'
information because none of the Screen objects are preceeded by a
Push/Radio Button with more than two prompts.
|