Legacy Documentation

Publicon® (2004)

This is documentation for an obsolete product.
Current products and services

Documentation  / Publicon  / User Guide  / Advanced Features  / Creating Document Palettes  /

Button Mechanics

Most of the buttons in a document palette exploit a special Publicon function called CellWriteStyle, which accepts a complex assortment of arguments, but the simplest is {"Section"} with "Section" being the name of the style you want the button to apply. CellWriteStyle executes different actions depending on the nature of the user's selection and the arguments provided. All attempts should be made to use it before considering any other specialized button functions described in the following section.

See Creating Palettes and Buttons for details on editing buttons with the Edit Button dialog box. Briefly, simply select the button text and choose Edit RightTriangle Button, then fill out the fields and make the appropriate selections. Never set the buttons as "Active", as this makes them difficult to edit. They become active when generated as the final palette.

An alternative method for editing buttons is to expose the underlying cell expression. With the selection on the cell bracket or within the contents of the cell, apply the following keyboard shortcut: ShiftKeyKeyBarControlKeyLeftModifiedERightModified (Windows); ShiftKeyKeyBarCommandKeyLeftModifiedERightModified (Macintosh); ShiftKeyKeyBarMod1KeyLeftModifiedERightModified (X) to toggle the cell expression display mode. This feature is only active in the document palette source files and in style sheets. Editing within this mode should only be done after gaining some experience with notebook syntax, as any slight error will cause syntax problems and might be difficult to recover. Note also that this mode works best in style sheets, where all keyboard actions such as Return, Delete, Copy, and Paste function naturally. In the palette source files, which are simply regular notebooks, these key events are evaluated for special behaviors convenient for document composition. These background evaluations cause some undesirable side-effects, primarily attempts by Publicon to evaluate an unfinished expression (since you are in the process of editing it). Alternates for each of these key events bypass the normal background processing modes. ShiftKeyKeyBarControlKeyLeftModifiedBackspaceRightModified (Windows); ShiftKeyKeyBarCommandKeyLeftModifiedBackspaceRightModified (Macintosh); ShiftKeyKeyBarMod1KeyLeftModifiedBackspaceRightModified (X) overrides normal backspace. ShiftKeyKeyBarControlKeyLeftModifiedReturnRightModified overrides Return on all platforms. ShiftKeyKeyBarControlKeyLeftModified3RightModified (Windows); ShiftKeyKeyBarCommandKeyLeftModifiedcRightModified (Macintosh); ShiftKeyKeyBarMod1KeyLeftModifiedcRightModified (X) overrides Copy. ShiftKeyKeyBarControlKeyLeftModifiedvRightModified (Windows); ShiftKeyKeyBarCommandKeyLeftModifiedvRightModified (Macintosh); ShiftKeyKeyBarMod1KeyLeftModifiedvRightModified (X) overrides Paste.

Toggling the cell expression is the most convenient method for editing the "New Document" button's ButtonData, since that tends to be a long list which does not fit in the Edit Button dialog box. The list is contains all the cell expressions that should be inserted into a new document template. For more details, see the documentation for GenerateDocument. The first (or only) argument to this function sets the style sheet used for the new document, so if you are not interested in providing template cells, you can edit the New Document button with the Edit Button dialog box just for applying the style sheet argument in ButtonData.

Buttons are also configured via style definitions in the palette source document's embedded (private) style sheet. Button functionality and appearance can be controlled in style definitions, and the styles are applied to the buttons as cell styles in the source document, not button styles. In order to apply these cell styles, you must select the cell bracket and choose Format RightTriangle Style RightTriangle Other and type the style name.

In general, the simplest approach to creating a new document palette is to find buttons in the existing palettes that performed the desired actions and collect them into your own palette. The combination of copying and pasting, editing the button names, and adjusting the button data in the Edit Button dialog will accommodate the needs of most users. Note that buttons are often configured in multiple cells arrangements, so be sure to make selections carefully. The easiest method for selecting a single button is to triple-click the contents.