# BUG: Using CNTPAD() and SET COMP ON Returns Incorrect Value

ID: Q124354

The information in this article applies to:

- Microsoft FoxPro for Windows, version 2.6a

## SYMPTOMS

Using CTNPAD() with SET COMP ON results in an incorrect return value.

## WORKAROUNDS

Use the SET COMP OFF command instead; it results in a correct value. Otherwise, simply subtract 1 from the value being returned. In the example provided below you could substitute the line:

       wait WINDOW str(cntpad('xmain'))

with:

       wait WINDOW str(cntpad('xmain')-1).

## 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 Behavior

In the following example program, CNTPAD() should return 2, which it does when SET COMP is OFF. But if SET COMP is ON, CNTPAD() returns 3.

clear DEFINE MENU xmain

DEFINE PAD p1 OF xmain PROMPT "pad1" COLOR SCHEME 3 DEFINE PAD p2 OF xmain PROMPT "pad2" COLOR SCHEME 3 ON PAD p1 OF xmain ACTIVATE POPUP pad1 ON PAD p2 OF xmain ACTIVATE POPUP pad2

DEFINE POPUP pad1 MARGIN RELATIVE SHADOW COLOR SCHEME 4 DEFINE BAR 1 OF pad1 PROMPT "bar1 p1"

DEFINE POPUP pad2 MARGIN RELATIVE SHADOW COLOR SCHEME 4 DEFINE BAR 1 OF pad2 PROMPT "bar1 p2"

ON SELECT BAR 1 OF pad1 do tempk

ON SELECT BAR 1 OF pad2 do tempk

ACTIVATE menu xmain

proc tempk wait WINDOW str(cntpad('xmain')) return

Additional reference words: FoxWin 2.60a buglist2.60a KBCategory: kbprg kbbuglist KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995 © 1999 Microsoft Corporation. All rights reserved. Terms of Use.