Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Menu at runtime - Facing problem
Message
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00794840
Message ID:
00794872
Views:
15
Hi Anwar,

I think that your code doesn't work because VFP uses variable names not tere values as menu names. In the sample code below (which works) variables are enclosed into parenthesis. It's called Name Expression and it tells VFP to use variable value not its name. You'll have to adjust your code accordingly.
vProcess = "Test"
vp = "p"+ vProcess
Descr = "Test Pad"

DEFINE PAD (vp) OF _MSYSMENU PROMPT (ALLTRIM(Descr))
ON PAD (vp) OF _MSYSMENU ACTIVATE POPUP (vProcess)
DEFINE POPUP (vProcess) MARGIN RELATIVE COLOR SCHEME 4

vRec = RECNO()
i = 1
FOR i=1 TO 3
	Descr = "Test bar " + TRANSFORM(i)
	DEFINE BAR i OF (vProcess) PROMPT (ALLTRIM(Descr))
ENDFOR
>Hi all,
>i'm trying to build the menu at runtime according to the structure i define in a recursive structured table, but when i execute this program this dont work only the top most level comes, wut could be the possible cause of this and wuts wrong with this code.
>
>here is the tables structure
>
>Field
>------- ---------------------
>Process ID of the Process or Menu Item
>Descr Description of Menu Item
>ty Type stores: 'M' for Menu (Sub menu) 'F' for Forms or Commands
>parent Recursive foriegn key to Process field to hold the 'Parent ID', '0' to the Higher Most with no parent
>level this is the Sequence number to display the Menu
>

>SET SYSMENU SAVE
>SET SYSMENU TO
>
>SELECT cMenu
>GO TOP
>DO WHILE !EOF()
> IF ALLTRIM(parent)=0 AND ALLTRIM(ty)="M" AND ALLTRIM(process)<>"0"
> STORE "p"+ALLTRIM(PROCESS) TO vP
> STORE ALLTRIM(process) TO Vprocess
>
> DEFINE PAD '&vP' OF _MSYSMENU PROMPT ALLTRIM(Descr)
> ON PAD '&vP' OF _MSYSMENU ACTIVATE POPUP vProcess
> DEFINE POPUP vProcess MARGIN RELATIVE COLOR SCHEME 4
>
> vRec = RECNO()
> i = 1
> SCAN FOR ALLTRIM(Parent) = vProcess
> DEFINE BAR i OF vProcess PROMPT ALLTRIM(Descr)
> i = i+1
> ENDSCAN
> GO vRec
>
> ENDIF
>SKIP
>ENDDO
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform