Using Sun WorkShop

Using the Button Editor

You can use the Button Editor (see Figure 5-3) to add, remove, or edit buttons in the Custom Buttons window. Buttons you add to the Custom Buttons window are stored in your Sun WorkShop options file. You no longer need to store buttons in your .dbxrc file. You cannot add buttons to, or remove buttons from, your .dbxrc file with the Button Editor.

Figure 5-3 Button Editor Window

Graphic

To open the Button Editor, choose Windows > Button Editor in the Debugging window.

You can add buttons from the button list to the Custom Buttons window. If you want to add a button that is not on the button list, you must first import the button, if it already exists (see "Adding Builtin Buttons to the Button Editor""), or create the button using the Create/Edit Button panel in the Button Editor (see "Adding a Button to the Button Editor"").

Adding Builtin Buttons to the Button Editor

To import buttons to the Button Editor:

  1. Click Builtin Buttons to display the Button Palette.

    The builtin button list in the Button Palette lists:

    • All the buttons that populate the tool bars in the Debugger window

    • A number of buttons that access functionality available only from the menus (such as the Breakpoints button to open the Breakpoints window)

    • Some buttons that offer functionality not available on the tool bar or the menus (such as the Dump button to print local variables)

  2. Select the buttons you want to import to the Button Editor and click OK.

    The buttons are added to the button list in the Button Editor.

Adding a Button to the Button Editor

To add a button to the Button Editor:

  1. Decide whether you want to put text or an icon on the button.

  2. To put text on the button, click the Text radio button and type the text in the corresponding text box.

  3. To put an icon on the button, click the Icon radio button, and type the file name of an icon.

    Click the browse button to display a dialog box you can use to choose an icon file. The icon file must be in the .xpm file format. Sun WorkShop tool bar icons are 20x20 pixels, and use only colors from the Sun WorkShop palette.


    Tip -

    You can use the CDE application dticon to create an .xpm file. Most graphics programs can also save files in .xpm format.


  4. In the Dbx Command text box, type the dbx command you want executed when the button is clicked.


    Tip -

    Type commands in the Dbx Commands window to see what commands are available.


  5. If you want the button to execute a dbx command that takes an argument, you must select one of the radio buttons under Append/Insert(%s) To Command On Button Press to specify the text to append to the command.

    • The Nothing radio button is selected by default indicating that no text is to be added to the command.

    • If you click the Selected Text radio button, the current Sun WorkShop selection is appended to the command.

    • If you click the File: Line Number radio button, the file name and line number of the selection are appended to the command.

  6. If you want the argument embedded in the command rather than appended to it, type %s in the command string to indicate the position of the argument.

    For example, if you type the following command string in the Dbx Command text box

    stop at %s -temp

    and select the File: Line Number of Selection radio button, the button will execute the following command if it is clicked when line 25 in main.cc is selected:

    stop at "main.cc":25 -temp


    Note -

    The command string should contain only one %s, and it cannot contain an escape sequence. For example, stop %%s -temp produces stop %"main.cc":25.


  7. Click Add and the button is added to the button list.

Adding the Buttons to the Custom Buttons Window

You can add the buttons in the button list in the Button Editor to the Custom Buttons window.

To add a button to the Custom Buttons window, click Apply to add the new button to the Custom Buttons window.


  1. Note -

    You can also add a button to the Custom Buttons window using the dbx button command.


Editing an Existing Button

To edit an existing button in the Button Editor:

  1. Select the button in the button list.

  2. Edit its properties using the text boxes and radio buttons in the Create/Edit Button panel, as described in "Adding a Button to the Button Editor".

  3. Click Change to apply the new properties to the button.

  4. Click Apply to replace the button in the Custom Buttons window with the edited button.

Rearranging Buttons

You can change the position of a button in the Custom Buttons window by moving it up or down on the button list in the Button Editor.

To rearrange the buttons:

  1. In the button list, select the button you want to move.

  2. Click Move Up or Move Down until the button's position in the button list corresponds to where you want it to be displayed in the Custom Buttons window.

  3. Click Apply and the button is displayed in its new position in the Custom buttons window.

Removing a Button

You can remove a button from the Custom Buttons window by deleting it from the button list in the Button Editor.

To remove a button:

  1. In the button list, select the button you want to delete.

  2. Click Delete and the button is deleted from the button list.

  3. To remove the button from the Custom Buttons window, click Apply.


    Note -

    You can also remove a button from the Custom Buttons window using the dbx unbutton command.



    Note -

    You cannot permanently delete a button stored in your .dbxrc file using the Button Editor. The button will reappear in your next debugging session. You can remove such a button by editing your .dbxrc file.