Middle-click menu - dialog questions

A middle-click menu, using jscript and a dialog, for the purposes of doing things like toggling toolbars and thumbnail labels etc. Written as a command that can be assigned to middle-click actions.

  • is it possible to have no titlebar.
  • is it possible to click outside the dialog to close it
  • is it possible to have the dialog appear under the mouse pointer
1 Like

Scripts can create actual pop-up menus, which should be easier unless you want something exotic inside the menu.

Having trouble with quotes in quotes when calling RunCommand().
Here is code (pretty short for what it is) the relevant bits are in vCommands[1 and 2], choice 1 is called but does not do anything choice 2 works as expected.

//Popup List for middle-click button
// Initialize script
function OnInit(initData)
    // Provide basic information about the script by initializing the properties of the **ScriptInitData**object
	// https://docs.dopus.com/doku.php?id=reference:scripting_reference:scripting_objects:scriptinitdata
	initData.name = "Popup List";	// Script Add-Ins name
	initData.version = "1.0";
	initData.copyright = "(c) 2023";
	initData.url = "https://resource.dopus.com/t/iconset-https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546/3maker-v2/42158/2";
	initData.desc = "Simple popup list called as a command, can be bound to mouse background events";
	initData.group = "Commands";
	initData.default_enable = true;
	initData.min_version = "13.0";

    // Create a new **ScriptCommand**object and initialize it to add the command to Opus
	// https://docs.dopus.com/doku.php?id=reference:scripting_reference:scripting_objects:scriptcommand
	var cmd = initData.AddCommand();
	cmd.name = "popupList";		// command name
	cmd.method = cmd.name;
	cmd.desc = initData.desc;
	cmd.label = initData.name;	// customize dialog name

function popupList(clickData)

  DOpus.Output("before dlg.Show() ");

  var vChoices = DOpus.Create.Vector
    "A Choice 1",
	"B Choice 2"

  var vCommands = DOpus.Create.Vector
    "Toolbar 'Images' STATE=bottom TOGGLE LINE=0",
	"Toolbar Images STATE=bottom TOGGLE LINE=0"

  var cmd = clickData.func.command;
  var dlg = clickData.func.Dlg;
  dlg.choices = vChoices;
  dlg.menu = 0;

  if (dlg.result) 
	DOpus.Output("cmd called");
	cmd.RunCommand(vCommands[dlg.result - 1]);

  DOpus.Output("after dlg.Show() " + " --- " + vChoices[dlg.result - 1]);
  DOpus.Output("Return code = " + dlg.result);
  if (dlg.result) DOpus.Output("Command = " + vCommands[dlg.result - 1]);

Javascript - Either of these will put quotes in a string; both have the same result:

"A \"quoted\" word"
'A "quoted" word'

That was quick, thanks, the first option works great :slight_smile:

any way of changing font or font-size for popup lists ?

No they just use the standard menu font.

I use Gui instead. You can even display multiple Gui queues at the same time.