ButtonData.childimages doesn't seem to have any effect

Started using the newly introduced dynamically-generated buttons to enhance my Dynamic TabGroups FAYT script.
I can't seem to manage to display images for submenus.
I do get first level items to get an icon (including the sub-menu), but after that ... no more:

See code below (sorry for the big size, but it's the evolution of previous code).
FAYT Dynamic TabGroup.opusscriptinstall (11.7 KB)

The buttons building section is in recursive function BuildOpenButtonsFromSettings.

function BuildOpenButtonsFromSettings(tabGroupList, addButtonHelper, action, path) {
	var rootPath = path || "";
	var prefix = (action == "open")?Script.Config["Open buttons pre-label"]:Script.Config["Append buttons pre-label"] + " ";
	var icon = (action == "open")?Script.Config["Open buttons image"]:Script.Config["Append buttons image"];
	var folderIcon = "#folder";

	var m = DOpus.Create.Map();
	for (var e = new Enumerator(tabGroupList); !e.atEnd(); e.moveNext()) {
		var grp = e.item();
		dout("Processing GRP='" + grp.name + "'");
		if (grp.hidden) continue;
		if (grp.folder) {
			if (!grp.count) continue;	// Do not process empty groups
			var menu = addButtonHelper.AddMenu();
			menu.label = DoubleAmpersands(grp.name);
			menu.image = folderIcon;
			menu.childimages = "on";
			menu.notablabel = true;

			m.merge(BuildOpenButtonsFromSettings(grp, menu.children, action, rootPath + grp.name + "/"));
		}
		else {
			m(rootPath + grp.name) = grp;
			var button = addButtonHelper.AddButton();
			button.label = DoubleAmpersands(prefix + grp.name);
			button.func = 'FAYTDynGroupsManage RUN_ACTION=' + action + ' RUN_ARG="' + rootPath + grp.name + '"';
			button.image = icon;
			button.notablabel = true;
			button.desc = GetTooltipForGroup(grp);
		}
	}
	// dout("Ending GetGroupsFromSettings for path=" + rootPath);
	return m;
}

Is it me doing it wrong or can you reproduce (with this example or more simple one)?

Try setting it to true, not "on".

That value is coming from the release notes.
Tried true, not working either.

Hi @Jon. Coming back regarding this issue.
I built a much smaller (dummy) example:

  • Builds a command to test (TestDynMenu) which can accept argument LIST to display a menu
  • Menu consists of:
    • 1 button with icon (OK)
    • 1 menu with icon (OK)
      • 1 sub-item with icon (Not OK)
    • 1 button with icon (outside of the menu) (OK)

All three buttons are built exactly in the same way (properties set) from a addButtonHelper.

For the value of menu.childimages, I tried "on", "ON", "On", "#on", true, "true", false, "icon", "icons", "#newtab" ... without any success in getting an icon to display for the button in the submenu.

Script and code below:

TestDynamicMenus.opusscriptinstall (1.2 KB)

Code
// TestDynamicMenus
// (c) 2025 Stephane

// This is a script for Directory Opus.
// See https://www.gpsoft.com.au/endpoints/redirect.php?page=scripts for development information.



// Called by Directory Opus to initialize the script
function OnInit(initData)
{
	initData.name = "TestDynamicMenus";
	initData.version = "1.0";
	initData.copyright = "(c) 2025 Stephane";
//	initData.url = "https://resource.dopus.com/c/buttons-scripts/16";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "13.0";
	initData.group = "Test";
}

// Called to add commands to Opus
function OnAddCommands(addCmdData)
{
	var cmd = addCmdData.AddCommand();
	cmd.name = "TestDynMenu";
	cmd.method = "OnTestDynMenu";
	cmd.desc = "";
	cmd.label = "TestDynMenu";
	cmd.template = "LIST/S";
	cmd.dynamic_args = "LIST";
	cmd.hide = false;
	cmd.icon = "script";
}


// Implement the TestDynMenu command
function OnTestDynMenu(scriptCmdData)
{
	DOpus.Output("TestDynMenu");
}


function OnAddButtons(addButtonsData) {
	// Make sure we're being called because of the LIST argument, otherwise bail.
	if (!addButtonsData.args.got_arg.LIST)
		return false;

	var addButtonHelper = addButtonsData.buttons;

	// Simple Item #1
	var button = addButtonHelper.AddButton();
	button.label = "Test 1";
	button.func = 'Set NOOP';
	button.image = "#newtab";
	button.notablabel = true;
	button.desc = "Some desc 1";

	// MENU
	var menu = addButtonHelper.AddMenu();
	menu.label = "Menu";
	menu.image = "#folder";
	menu.childimages = true;
	menu.notablabel = true;

	// Item inside Menu
	var buttonInMenu = menu.children.AddButton();
	buttonInMenu.label = "Test In Menu";
	buttonInMenu.func = 'Set NOOP';
	buttonInMenu.image = "#newtab";
	buttonInMenu.notablabel = true;
	buttonInMenu.desc = "Some desc in menu";



	// Simple Item #2
	var button2 = addButtonHelper.AddButton();
	button2.label = "Test2";
	button2.func = 'Set NOOP';
	button2.image = "#newtab";
	button2.notablabel = true;
	button2.desc = "Some desc 2";

	return true;
}

EDIT: Re-uploaded the script which contained a typo (in one of the tests, I replaced the first button.notablabel property value instead of menu.childimages value).

This should be fixed in Directory Opus 13.15.3 (Beta).

1 Like

Working now in 13.15.3.
Thanks.

1 Like