Part 2a

Add Action to the GUI

Adding EMC Actions

  1. Open up gui1.glade and save as gui2.glade. Lets change the default height of window1 to 480 and the default width to 640 and don’t for get to press the Enter key so the change is saved.

    Go to the notebook1 and remove the labels from the middle of each tab. Right click in the last empty tab and select Insert Page After. Next change the Tab Position: to Left. Click on each tab and starting from the top change the labels to Back Plot, DRO, MDI and G code. Your screen should be like the following.

    Your project should look like this now.

    images/gui-02-01.png
  2. Select the Back Plot tab and add the HAL Gremlin Plus widget.

    Your project should look like this now.

    images/gui-02-02.png
  3. Put a GtkLabel in the DRO tab and the MDI tab just give them some content for now. In the G code tab put a Scrolled Window then put a VCP SourceView into the Scrolled Window.

    Your project should look like this now.

    images/gui-02-03.png
  4. Next we will add some actions like in the first tutorial for the button bar.

    • VCP Action Open - Label: Open

    • VCP Toggle Action Power - Stock Icon: Connect

    • VCP Toggle Action Run- Stock Icon: Play

    • VCP Toggle Action Pause- Stock Icon: Pause

    • VCP Toggle Action Stop- Stock Icon: Stop (the square one)

      Your project should look like this now.

      images/gui-02-04.png
  5. Now add some buttons to the button bar. Click on the button bar then click on the editor. In the Hierachy tab add the following buttons. Change each one to Use Action Appearance: Yes after adding the Related Action:

    • Toggle - Related Action: hal_toggleaction_power1

    • Toggle - Related Action: hal_toggleaction_run1

    • Toggle - Related Action: hal_toggleaction_pause1

    • Toggle - Related Action: hal_toggleaction_stop1

      Close the Editor and your project should look like this now.

      images/gui-02-05.png
  6. Now double click on File then click on Open in your project and pick hal_action_open1 for the Related Action: and change Use Action Appearance: to Yes.

Save your glade file.