Using "Load" to bring up a sub menu
Posted: 24 Feb 2015 21:54
Hi, I've be struggling trying to fix a syntax problem in a script I'm writing. I'm hoping someone might be able to help me out or point me in the right direction. It's been driving me nuts all day. The menu uses a couple of developed variables and also uses heredoc. I have a sub menu I want to show up only after clicking on the item in the main menu, but instead it rears its ugly head on the main menu. If I use the exact same variable ($toolmen) and write to a script file the menu looks and works just fine, but I can't get it to display properly when using SC load with the "s" parameter like so, "load ($toolmen, , "s");" The code lines under the "Save menu item don't show up or execute until the Save heading is clicked, but the load of $toolmen does. Here the portion of the script. The menu is displaying as seen here, but what I want to happen is the Vertical Toolbar menu to display only when that main menu item is clicked.As I said above, if I write "$toolmen" to a xys script "file", and then below the Vertical Toolbar title, I use load with the "f" parameter, it looks and works as it should (i.e., the menu comes up separately) as a sparate sub-menu. I originally had the $toolmen developed directly under the menu item with in the herdoc and that was even worse due to the <crlf> problems even using chr(13) didn't help. Any thoughts on what I may do doing wrong? Thanks,
Ken
Code: Select all
if ($toolbars) {
$toolmen = "";
foreach ($item, $toolbars, "|") {
$toolmen = $toolmen . " $item"<crlf>;
$toolmen = $toolmen . " toolbar(readfile(""$DIR_TOOLBARS\$item.txt""));<crlf>";
}
$toolmen = """Vertical Toolbars|$ICO_TOOLBARS""" . ";" . <crlf> . $toolmen;
}
//writefile("<xyscripts>\ToolM.xys", $toolmen, o); if I use this line and later use the "f" parameter with load it works fine
$savemenu = <<<#SAV
"Save Toolbar|D:\Graphics\Icons\Combined\Customize Toolbar on.ico";
$TB_name = input("Save current toolbar as: ", "Change this text here" , , "s");
writefile("$DIR_TOOLBARS\$TB_name.txt", $TB_build);
"Vertical Toolbars|D:\Graphics\Icons\Combined\Customize Toolbar on.ico";
load ("$toolmen", ,"s");
#SAV;
$ctbScript = $ctbScript . "-" . <crlf> . $savemenu;
Load ($ctbScript, , "s");
Ken