Example: Add popup menus
The
text editor example has four choices on its
Edit pull-down menu that would be useful to have on a popup menu.
Adding a popup menu
To add a popup menu that has the four choices:
1. Select
![Popup Menu icon Popup Menu icon](../hd/images/mnupop.gif)
(Popup Menu part) from
![Menus category icon Menus category icon](../hd/images/menucat.gif)
(Menus category).
2. Click on the free-form surface.
3. Put a check mark in the Sticky check box.
4. Select
![Menu Choice icon Menu Choice icon](../hd/images/mnuch.gif)
(Menu Choice part).
5. Click four times on the Popup Menu part.
6. Click on
![Selection tool Selection tool](../hd/images/select.gif)
(Selection tool) to de-activate the
Sticky.
7. Change the labels of the popup menu choices to Cut, Copy, Paste, and Select all.
Adding a separator
Next, add a separator between the Paste and Select all choices.
![Separator icon Separator icon](../hd/images/separ.gif)
(Separator part) is in
![Menus category icon Menus category icon](../hd/images/menucat.gif)
(Menus category).
Adding the connections
Finally, add the connections. Connect the clicked event of each menu choice to the following actions:
Menu choice
Target action
Cut
Multi-line Edit's cutSelection
Copy
Multi-line Edit's copySelection
Paste
Multi-line Edit's paste
Select all
Multi-line Edit's selectAll
And, connect the popup menu's self attribute to the Multi-line Edit's menu attribute.
Now you're done! Select
![Test Test](../hd/images/test.gif)
(Test tool) and try out the menus. Then, save the part.
Last modified date: 08/14/2019