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 part) from
(Menus category).
2. Click on the free-form surface.
3. Put a check mark in the Sticky check box.
4. Select
(Menu Choice part).
5. Click four times on the Popup Menu part.
6. Click on
(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 part) is in
(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 tool) and try out the menus. Then, save the part.
Last modified date: 08/14/2019