Toolbar and menu
Adding menus and toolbars with the declarative API is very straightforward. The MainWindow struct has the Menu field (which is a slice of MenuItem) and the ToolBar field (which takes a ToolBar struct that contains an Items field for the MenuItem list). Each item in the list is either an Action, a Separator, or another Menu that mirrors the designs we created earlier.
Each Action in the declarative API expects a Text string that is used for the display in menus. Toolbars also use this content for tooltips, and for display if the style is set to ToolBarButtonTextOnly. An Image field allows you to set an icon for the toolbars if you want to reference installed images or icons distributed with your app. Most important is the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access