Dynamically Generated Menus

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
arirish
Posts: 93
Joined: 13 May 2008 13:52

Dynamically Generated Menus

Post by arirish »

Daft topic titles aside, is it possible to use a CTB to show, say, the contents of a folder, and to have that menu change depending on what was in the folder?

I know the POM button changes based on what's selected in the list, but wasn't sure if this sort of functionality is available for custom buttons.

admin
Site Admin
Posts: 66350
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Dynamically Generated Menus

Post by admin »

No, although TheQwerty has suggested a way to add this to scripting some time ago. It might come later.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Dynamically Generated Menus

Post by jacky »

the_hyrax_lord wrote:Daft topic titles aside, is it possible to use a CTB to show, say, the contents of a folder, and to have that menu change depending on what was in the folder?

I know the POM button changes based on what's selected in the list, but wasn't sure if this sort of functionality is available for custom buttons.
I'm not exactly sure what's the intent here, but just to say: something somewhat like that, if not that, can be done. I mean, I do have a CTB that I use every day, that doesn't show me the same menu depending on things like what's the current location. Couldn't be easier, just have the button trigger a script like this one:

Code: Select all

	// determine which script to load(/menu to show)
	if ('D:\Projects' == substr(<curpath>, 0, strlen('D:\Projects')))
	{
		$script = 'mnu-projects';
	}
	elseif ('I:\WAMP\www' == substr(<curpath>, 0, strlen('I:\WAMP\www')))
	{
		$script = 'mnu-web-stuff';
	}
	elseif ('\\PC-ASSO\folder' == substr(<curpath>, 0, strlen('\\PC-ASSO\folder')))
	{
		$script = 'mnu-shared-loc';
	}
	else
	{
		$script = 'mnu-default';
	}
	// go
	load $script;
That's all. (Then, one could even add other tests, such as is there a selection or not, only one item selected, only folders selected, etc)

(Yes I'm showing up to bump "old" topics now. 'tis what I do when the heat sets in... :P)
Proud XYplorer Fanatic

Post Reply