Context menu
A context menu allows users to take actions relevant to a widget. Users can open context menus by right clicking on a widget or long pressing down on a widget for 500 milliseconds, so context menus work on all platforms.
You can add buttons to the context menu of a widget:
tf := core.NewTextField(b)
tf.AddContextMenu(func(m *core.Scene, pos image.Point) {
core.NewButton(m).SetText("Build")
core.NewButton(m).SetText("Run")
})You can remove all of the context menu buttons of a widget:
tf := core.NewTextField(b)
tf.ContextMenus = nilScene context menu
Note that there is still a context menu in the example above since all widgets inherit the scene context menu items, which consist of various important actions by default, such as the settings and inspector. You can remove these items if you want:
myWidget.Scene.ContextMenus = nil