Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Popup names from menu file.
Message
 
 
To
03/01/2001 09:37:29
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00458411
Message ID:
00458953
Views:
31
Here is the new and improved recursive version of my code:
lparameters lcmenuname, tnpad
local lnpad, lcpopname, lcpadprompt, lcbarprompt
if vartype(tnpad) $ "YNIB" then
	lnpad = tnpad + 1
else
	lnpad = 0
endif
local lxx, lyy, lzz
for lxx = 1 to cntbar(lcmenuname)
	lcpadprompt = prmbar(lcmenuname,getbar(lcmenuname,lxx))
	
	* build a string with disallowed characters
	lcdisallowed = space(0)
	for lyy = 1 to 47
		lcdisallowed = lcdisallowed + chr(lyy)
	endfor
	
	for lyy = 58 to 64
		lcdisallowed = lcdisallowed + chr(lyy)
	endfor

	for lyy = 91 to 96
		lcdisallowed = lcdisallowed + chr(lyy)
	endfor

	for lyy = 123 to 255
		lcdisallowed = lcdisallowed + chr(lyy)
	endfor

	lcpopname = chrtran(lcpadprompt,lcdisallowed,"")
	? space(3*lnpad)+lcpopname
	
	if getbar(lcmenuname,lxx) > 0 and popup(lcpopname) then
		for lzz = 1 to cntbar(lcpopname)
			lcbarprompt = prmbar(lcpopname,lzz)
			? space(3*(lnpad+1))+lcbarprompt
			if popup(lcbarprompt) then
				* a popup exists with this name; recursively call this routine
				=testmenu(lcbarprompt,lnpad+1)
			endif
		endfor
	else
		* we are talking about a system menu item and cntbar() won't work
	endif
endfor
The task is not impossible (as the above shows), but the ultimate use for it escapes me. If you are going to use this as a one time setup after installation, then I can see some use for it. But in that case, you know the available menu options and (as someone pointed out earlier in this thread) you could put those in a table and update it when you update the menu.

The skip for clause would call a generic function with an ID attached. You could include this when designing the menu. The function would perform a lookup on the ID and pass back .T. or .F. to display the option or not.

I guess using this as a developer tool to initially populate the menu option table, it works.

HTH.

>Thank you Larry, but your code didn't fix my problem as well... =o(
>
> When I ran it on my menu, it just retrieved the Popup names for the Pads on my menu. On some of the Bars on those Popups, I have other Popups... Can I use it to retrieve these? And if so, how?
> My ultimate goal is to have a Form with two listboxes (lstPOPs & lstBARs). When the form is initiated, the code will have to go through the active menu and display in lstPOPs all the Popups in it, so that when I select one of them from lstPOPs, lstBARs displays all the Bars in the selected Popup.
>
> I'm starting to think that this is an impossible task... Please tell me I'm wrong.
>
> Best regards,
>
> Pedro.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform