29.01.2017 Views

UPDATED

Customizing-BricsCAD-V17

Customizing-BricsCAD-V17

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

To indicate that the button opens another dialog box, use an ellipsis ( ... ), such as Info....<br />

In addition to text and image buttons, settings can be changed with check boxes (toggle tiles) and<br />

radio buttons (radio_button tiles), as described next.<br />

Making Buttons Work<br />

OK and Cancel are easy, because their functions are already defined. It’s one thing to populate a<br />

dialog box with buttons; it’s another to have them execute commands.<br />

Let’s see how to make buttons execute commands. In the tutorial, you create a dialog box with Plot<br />

and Preview buttons. The figure below shows how it will look in Linux; it looks similar in Windows.<br />

The purpose of the Plot button is to execute the Plot command, and of Preview button to execute<br />

the Preview command.<br />

The easy solution would be to add an action attribute to each button to execute a LISP function,<br />

such as (command "plot"). But we cannot, because DCL does not allow the highly-useful command<br />

function to be used in the action attribute!<br />

The key to solving the problem is the key attribute. It gives buttons identifying names by which<br />

LISP functions can reference them, such as:<br />

key = "plot";<br />

Then, over in the LISP file, you use the action_tile function to execute the Plot command. Well,<br />

not quite. It has the same restriction against use of the command function, so you must approach<br />

this indirectly by getting action_tile to refer to a second LISP routine, such as (action_tile "plot"<br />

"(cmd-plot)").<br />

But even this will not work, because you need your custom dialog box to disappear from the screen,<br />

and be replaced by the Plot dialog box. The solution is to become even more indirect:<br />

(action_tile "plot" "(setq nextDlg 1) (done_dialog)")<br />

"plot" — identifies the Plot button through its key, "plot".<br />

(setq nextDlg 1) — records that the user clicked the Plot button for further processing later on.<br />

(done_dialog) — closes the dialog box.<br />

This is done twice, once each when the user clicks the Plot button or the Preview button. The Preview<br />

button’s code is similar; changes are shown in boldface:<br />

(action_tile "preview" "(setq nextDlg 2) (done_dialog)")<br />

22 Designing Dialog Boxes with DCL 391

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!