I have the following program which correctly creates the menu and bar items (I have some extract variables defined I am using for debugging.
LOCAL lnRecs, i, j
LOCAL lcBarMsg, lcCxfer, lcClFile, lcCrFile, lcCros
LOCAL lnlenCxfer, lcSelected, lcPopUpName
LOCAL x
LOCAL laTansdef[1]
DECLARE laTansdef[1,4]
SELECT DISTINCT ;
cxfer , ;
clfile ,;
crfile ,;
cros , ;
cmduser ;
FROM transfer ;
WHERE !DELETED() ;
AND cmduser = ;
gcUserId ;
ORDER BY cxfer ;
INTO ARRAY laTansdef
lnRecs = ALEN(laTansdef)/4 - 1
IF lnRecs = 0
=msgfrm('There are NO Transfer Definitions to add' + ;
CHR(10) + SPACE(5) + 'to the Transfer Definitions nenu' ;
,'0',,'S','No Transfer Definitions',0,gnMsgWait)
RETURN .F.
ENDIF
lcPopUpName = 'Definitions'
DEFINE MENU TransferDefs FONT "Arial", 11 STYLE "I"
DEFINE PAD TransferDefs OF TransferDefs PROMPT "Transfer Definitions"
DEFINE POPUP &lcPopUpName FONT "Arial", 11 SHORTCUT
ON PAD TransferDefs OF TransferDefs ACTIVATE POPUP &lcPopUpName
FOR i = 1 to lnrecs
lcCxfer = ALLTRIM(laTansdef[i,1])
lnlenCxfer = LEN(lcCxfer)
lcClFile = ALLTRIM(laTansdef[i,2])
lcCrFile = ALLTRIM(laTansdef[i,3])
lcCros = ALLTRIM(laTansdef[i,4])
DO CASE
CASE !EMPTY(lcClFile) AND !EMPTY(lcCrFile)
lcBarMsg = lcCxfer + " - Copy locate file " + lcClFile + ;
" to remote file " + ;
lcCrFile+ " on " + lcCros
CASE !EMPTY(lcClFile) AND EMPTY(lcCrFile)
lcBarMsg = lcCxfer + " - Copy locate file " + lcClFile + ;
"Prompt for remote file on " + lcCros
CASE EMPTY(lcClFile) AND !EMPTY(lcCrFile)
lcBarMsg = lcCxfer + " - Prompt for local file " +
"and copy to remote " + ;
lcCrFile + " on " + lcCros
CASE EMPTY(lcClFile) AND EMPTY(lcCrFile)
lcBarMsg = lcCxfer + " - Prompt for local and remoter files and copy to " + lcCros
OTHERWISE
ENDCASE
DEFINE BAR i OF &lcPopUpName PROMPT lcBarMsg
ON SELECTION BAR i OF &lcPopUpName DO doftp WITH i , lcCxfer
ENDFOR
ACTIVATE MENU TransferDefs
My proplem is with the line
ON SELECTION BAR i OF &lcPopUpName DO doftp WITH i , lcCxfer
Currently all the
doftp program does is display what it thinks
i and
lcCxfer are. The problem it displays the last value "lcCxfer = TESTEB" and i = 5. But there ar only 4 menu itesm.
I tried setting j = 0 before the FOR loop and j = j + 1 to before the "ON SELECTION BAR" command, but the only difference is that j = 4 is displayed.
If a use the debugger I can see i and lcCxfer change values.
What am I doing wrong
TIA for any help.