Home Forums General XMetaL Discussion Styling custom PI’s Reply To: Styling custom PI’s

Derek Read

Reply to: Styling custom PI’s

Not exactly sure if this is useful but the following could be placed in an On_Click event macro to force the selection to be an entire “mytarget” PI when the user clicks inside one.

[code]//XMetaL Script Language JSCRIPT:
//create a Range object to work with the document
var rng = ActiveDocument.Range;
//store the current node, which should equal the PI
var curNode = rng.ContainerNode;
//only continue if we're in a “mytarget” PI, otherwise do nothing
if ((curNode.NodeType == 7) && (curNode.target == “mytarget”)) {
//change the user's selection to grab the entire PI
rng.SelectElement();
rng.Select();
}[/code]

Reply

Products
Downloads
Support