Page 1 of 1

Dynamically Generated Menus

Posted: 26 Jun 2010 21:26
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.

Re: Dynamically Generated Menus

Posted: 27 Jun 2010 10:43
by admin
No, although TheQwerty has suggested a way to add this to scripting some time ago. It might come later.

Re: Dynamically Generated Menus

Posted: 08 Jul 2010 19:17
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)