For a test I made a 2 dim array (menuitem, and the return value). Later will get this from database into a array.
Always when I touch arrays in combination with this kind of program rules, i spend hours looking for the correct syntax
If I leave out the -1 in the for next loop, i even get a bound error.
All this is basic, but It won't pop it..... (bad day)
- Code: Select all Expand view
static function TrainingMenu( ocol )
local oPop, cTemp
local aTrainingen:= { ;
{ "&Aanwezig" , "A" }, ; // 1
{ "&Ziek" , "Z" }, ; // 1
{ "&Kwetsuur" , "K" }, ; // 1
{ "&Schorsing" , "S" }, ; // 1
{ "&Verlof" , "V" }, ; // 1
{ "&Traint alleen", "T" }, ; // 1
{ "E&xamen" , "X" }, ; // 1
{ "Niet &fit" , "F" }, ; // 1
{ "&Clear" , "C " }} // 1
MENU oPop POPUP 2007
for i = 1 to len(aTrainingen)-1
cTemp = aTrainingen[i,2]
// MENUITEM aTrainingen[i,1] BLOCK { || oCol:varput("A"),oCol:oBrw:SetFocus() } // is working, but not dynamic... always A with is logic.
// MENUITEM aTrainingen[i,1] BLOCK ( oCol:varput(cTemp),oCol:oBrw:SetFocus() ) // shows always last item
MENUITEM aTrainingen[i,1] ACTION ( oCol:varput(aTrainingen[i,2]),oCol:oBrw:SetFocus() ) // shows menu, always last item
next
/*
MENUITEM "&Aanwezig" ;
ACTION ( oCol:varput("A"),oCol:oBrw:SetFocus() )
MENUITEM "&Ziek" ;
ACTION ( oCol:varput("Z"),oCol:oBrw:SetFocus() )
MENUITEM "&Kwetsuur" ;
ACTION ( oCol:varput("K"),oCol:oBrw:SetFocus() )
MENUITEM "&Schorsing" ;
ACTION ( oCol:varput("S"),oCol:oBrw:SetFocus() )
MENUITEM "&Verlof" ;
ACTION ( oCol:varput("V"),oCol:oBrw:SetFocus() )
MENUITEM "&Traint alleen maar" ;
ACTION ( oCol:varput("T"),oCol:oBrw:SetFocus() )
MENUITEM "E&xamen" ;
ACTION ( oCol:varput("X"),oCol:oBrw:SetFocus() )
MENUITEM "Niet &Fit" ;
ACTION ( oCol:varput("F"),oCol:oBrw:SetFocus() )
MENUITEM "&Clear" ;
ACTION ( oCol:varput(" "),oCol:oBrw:SetFocus() )
*/
ENDMENU
return oPop