Page 1 of 1

Custom toolbar button (load script and menu ID)

Posted: 20 Mar 2017 20:51
by tester
Within the help-file under the "Toolbar" chapter I read how to create a button.

Code: Select all

"Recent Locations|:mru" button "mru"
"Hotlist|:hotlist" button "hotlist"
-
"CKS|:cks" button "cks"
"UDC|:udc" button "udc"
-
"Exit no save|:exitnosave" button "exitnosave"
And

Code: Select all

load "test", "foo" //load script labeled "foo" from "test.xys"
But I could not achieve the below case.
For example, if I want a button with 2 items in it (see below, bold):
  • Config
    When this item is selected, I want the configuration dialog to be opened but using it's ID (Help >> Command ID's on menu)
  • Testscript
    When this item is selected, I want to run a test-script located in: c:\xy\test_123.xys
How would the button syntax would look like?
(When Config is selected I want to use the menu ID, if possible).

EDIT
An example of what I mean:

Code: Select all

Config|#600
Testscript|c:\xy\test_123.xys
But now in the correct syntax (if possible).
So when the custom button is pressed a menu folds out showing: "Config" and "Testscript" and executes/runs their corresponding action.

Re: Custom toolbar button (load script and menu ID)

Posted: 21 Mar 2017 01:37
by SkyFrontier

Code: Select all

   $a = popupmenu("Config;#600;:queue|Testscript;test;<xy>");
   if(substr("$a", 0, 1) == "#") { load $a, , s; } else { load "$a"; }
   
...assuming you have a 'test.xys' file under <xyscripts> folder.

Oh, new user! Welcome 2 the show!

Re: Custom toolbar button (load script and menu ID)

Posted: 21 Mar 2017 02:23
by tester
Hello, thank you for the welcome!
The script works, this will help a lot!