Page 1 of 1

Fivewin menus

Posted: Mon Apr 20, 2009 7:30 am
by ryugarai27
Hi All,

I'm new to FIvewin and I hope somebody could help me analyze what's going on with my code. I am trying to build menu from multidimensional array:

GLOBAL aAccessMenu := { { '&Login Ctrl L', 'Log out Ctrl X' },;
{ 'System Log in', 'System Log out' },;
{ FALSE, FALSE },; // checked?
{ TRUE, FALSE },; // status
{ {|| uCheckUserPass() } , nil },; // baction
{ nil, nil },; // resname
{ ACC_CONTROL, ACC_CONTROL },;
{ 'G', 'X' },;
{ 'Login', 'Logout' } }


and I use this code to build the menu:

MENU oMenu

oMenu:l2007 := TRUE

MENUITEM aItems[1] PROMPT '&Access ' MESSAGE 'System Access'

aItems[1]:Cargo := 'Access'

MENU oAccPopup

FOR i := 1 TO Len( aAccessMenu[1] )

MENUITEM aAccessItems PROMPT aAccessMenu[1] MESSAGE aAccessMenu[2] ;
ACTION aAccessMenu[5];
RESOURCE aAccessMenu[6];
ACCELERATOR aAccessMenu[7], Asc(aAccessMenu[8])

Msginfo( cvaltochar(aAccessItems:bAction) )

aAccessItems[1]:Cargo := aAccessMenu[9]

END
.....
.....

However, I noticed that the value of aAccessItems[1]:bAction is just simply "{||...} and not the value from the array which is {|| uCheckUserPass() }. How may i be able to call the function from multidimensional array and store it as valid function call in Tmenuitem?

Thanks.

Re: Fivewin menus

Posted: Mon Apr 20, 2009 7:56 am
by ryugarai27
Hi all,

I noticed that the system is trying to access the function uCheckUserPass() but loads nothing on the screen.. but the program is still running as i check on task manager.

I changed the code to:

MENUITEM aAccessItems PROMPT aAccessMenu[1] MESSAGE aAccessMenu[2] ;
ACTION uCheckUserPass();
RESOURCE aAccessMenu[6];
ACCELERATOR aAccessMenu[7], Asc(aAccessMenu[8])

and the code works fine...displaying the user interface dialog.

I also tried to put the codeblock in a varaible as:

GLOBAL b := {|| uCheckUserPass() }

and call as:

MENUITEM aAccessItems PROMPT aAccessMenu[1] MESSAGE aAccessMenu[2] ;
ACTION Eval(b);
RESOURCE aAccessMenu[6];
ACCELERATOR aAccessMenu[7][i], Asc(aAccessMenu[8][i])

and it works fine

but when I try it from multidimensional array:

MENUITEM aAccessItems[i] PROMPT aAccessMenu[1][i] MESSAGE aAccessMenu[2][i] ;
ACTION Eval(aAccessMenu[5][i]);
RESOURCE aAccessMenu[6][i];
ACCELERATOR aAccessMenu[7][i], Asc(aAccessMenu[8][i])


...it just doesn't work:


I'm wondering where did i went wrong...

Thanks...
ryugarai

Re: Fivewin menus

Posted: Wed Apr 22, 2009 11:43 am
by nageswaragunupudi
Instead of
ACTION aAccessMenu[5];

please try

Code: Select all

BLOCK aAccessMenu[5][i];