Trapping the ghost
Dear friends,
In my post Special effects - mostly unwanted I reported about some really persky things happening with my (now about 4500 lines) script. While the Twins and the Slave effect have disappeared by the time (not knowing which changes did it), the Ghost could not be trapped until now.
Hence, I have now stripped down the script to the bare bones, which also create this ghostly effect.
- Have any FM document open (it may be empty) and run the script Ghostbuster.jsx
- In the document type ESC, q, m, c
- The panel is opened
- You may type something in the edit field
- Cancel
- In the document type ESC, q, m, c
=> The ghost appears: a mysterious drop down list, which got text from the edit field and into which you can type (and if you do so), the typed text will apear in the next invocation of th panel.
Where the heck does this come from?
Ghostbusters are higly welcome!
Klaus
// Ghostbuster.jsx --- Attempt to find out what creates the ghost (artfacts) in the C and S panels.
#target framemaker
// === global variables, arrays ===================================================================
var wPalC = new Window("palette", undefined, undefined); // title set in PaletteCalcMarkers
var glbl = {};
glbl.sCalcMarkerText = "Some initial text";
main (); // follow the standard …function main () { //=== ==========================================================================
SetUpMenus(); // uncomment comment
}
function SetUpMenus () { //=== Define the menu items for document and book ========================
var bkFMcalcMenu, docFMcalcMenu, menuLocation, oMenus = {}, oCmd = {};
oMenus.MenuMain = "Calculations in FrameMaker…";
oMenus.HandleCalcMarker = "Handle #calc Markers…";
oCmd.HandleCalcMarker = DefineCommand(4,"docHcalcMarker", oMenus.HandleCalcMarker, "\\!qmc");
oCmd.HandleCalcMarker.KeyboardShortcutLabel = "ESC q m c";
menuLocation = app.GetNamedMenu("FormatMenu");
docFMcalcMenu = menuLocation.DefineAndAddMenu("!FMcalcMain", oMenus.MenuMain); // ! required
docFMcalcMenu.AddCommandToMenu (oCmd.HandleCalcMarker);
UpdateMenus(); // refresh and actually make the new menu appear
} //--- end SetUpMenusfunction Command (cmd) { //=== Assign functions to menu commands ==================================
switch (cmd) {
case 4:
PaletteCalcMarkers();
break;
}
} //--- end Commandfunction PaletteCalcMarkers(){ //=== Palette for handling #calc markers ===========================
wPalC.title = "FMcalc : Handle #calc Markers";
wPalC.st1 = wPalC.add('statictext',undefined,"Marker contents");
wPalC.st1.alignment = ['left',' '];
wPalC.st1.graphics.font = ScriptUI.newFont(wPalC.st1.graphics.font.family,"BOLD",wPalC.st1.graphics.font.size);wPalC.sMarkerContent = wPalC.add('edittext',undefined, glbl.sCalcMarkerText, {multiline:true, scrollable:true});
wPalC.sMarkerContent.graphics.font = ScriptUI.newFont ("Consolas", "", 12);
wPalC.sMarkerContent.preferredSize.width = 580;
wPalC.sMarkerContent.preferredSize.height = 65;
// //--- Button row Evaluate, Help, Cancel ---------
wPalC.g4 = wPalC.add('group',undefined);
wPalC.g4.alignment = ['fill',' '];
wPalC.g4.margins= [0,0,7,0]; // add right margin
wPalC.g4.Cancel = wPalC.g4.add('button',undefined,"Cancel");
wPalC.g4.Cancel.helpTip = "Dismiss dialogue panel";
wPalC.g4.Cancel.preferredSize.width = 137;wPalC.g4.Cancel.onClick = function () {
wPalC.close();
};
wPalC.show();
} //--- end of PaletteCalcMarkers -----------------------------------------------------------------

