Context Menus

Now that the drag and drop is complete we can add crops and animals to our field easily, however we can't remove them. In our design we used context menus to solve this problem:

Context menus

Therefore, we added a question to our investigation list:

  • How do we add contextual menus to objects?

To add this functionality to our crops and animals we will need to reimplement the contextMenuEvent method.

The video below demonstrates how to do this.

Task 8

Use the above video to add context menus so that crops and animals can be removed from the field.