Fivewin menus

Fivewin menus

Postby ryugarai27 » Mon Apr 20, 2009 7:30 am

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[i] PROMPT aAccessMenu[1][i] MESSAGE aAccessMenu[2][i] ;
ACTION aAccessMenu[5][i];
RESOURCE aAccessMenu[6][i];
ACCELERATOR aAccessMenu[7][i], Asc(aAccessMenu[8][i])

Msginfo( cvaltochar(aAccessItems[i]:bAction) )

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

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.
User avatar
ryugarai27
 
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines

Re: Fivewin menus

Postby ryugarai27 » Mon Apr 20, 2009 7:56 am

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[i] PROMPT aAccessMenu[1][i] MESSAGE aAccessMenu[2][i] ;
ACTION uCheckUserPass();
RESOURCE aAccessMenu[6][i];
ACCELERATOR aAccessMenu[7][i], Asc(aAccessMenu[8][i])

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[i] PROMPT aAccessMenu[1][i] MESSAGE aAccessMenu[2][i] ;
ACTION Eval(b);
RESOURCE aAccessMenu[6][i];
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
User avatar
ryugarai27
 
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines

Re: Fivewin menus

Postby nageswaragunupudi » Wed Apr 22, 2009 11:43 am

Instead of
ACTION aAccessMenu[5][i];

please try
Code: Select all  Expand view
BLOCK aAccessMenu[5][i];
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests