First, let’s create our ‘Delete’ button:

Adding a delete button to the ArticleView Form

Go to Design View of your ‘ArticleView’ Form, and drop a FlowPanel Flow Panel icon into the page. Move your edit_article_button into the FlowPanel. Then, drop a second button into the FlowPanel, and set the align property of the FlowPanel to ‘right’.

Select the new button, and rename it delete_article_button. Change the role to primary-color, the background property to ‘red’, and the foreground property to ‘white’. I also like to use the trash icon in place of text for my delete buttons. Finally, adjust the column width if necessary to make sure both buttons are displayed properly (use Ctrl+drag for finer adjustments).

Create an event handler for your delete button by double clicking the button in the designer.

  def delete_article_button_click(self, **event_args):
    """This method is called when the button is clicked"""