Difference between revisions of "Application.RefreshMenuBar"

From Xojo Documentation

(See Also)
(Notes)
Line 12: Line 12:
  
 
==Notes==
 
==Notes==
In most cases, the standard menu bar updating will be sufficient. There are cases, however, when it's not. For example, if the SelectionChanged event handler of a [[TextField]] control causes all of the menu items in a particular menu to be disabled, the menu itself should be disabled. Unfortunately, it won't be because the user has not yet clicked in the menu bar. Under circumstances like this, you can call the '''RefreshMenuBar''' method to force your app to only update the menus based on your own conditions.
+
In most cases, the standard menu bar updating will be sufficient. There are cases, however, when it's not. For example, if the SelChange event handler of a [[TextField]] control causes all of the menu items in a particular menu to be disabled, the menu itself should be disabled. Unfortunately, it won't be because the user has not yet clicked in the menu bar. Under circumstances like this, you can call the '''RefreshMenuBar''' method to force your app to only update the menus based on your own conditions.
  
Calling this calls MenuSelected event handlers on Application, Window, ContainerControl and MenuItem.
+
Calling this calls EnableMenu or EnableMenuItem event handlers on Application, Window, ContainerControl and MenuItem.
  
 
==Example==
 
==Example==

Revision as of 17:11, 12 November 2019

Method

Application.RefreshMenuBar()

New in 2019r2

Supported for all project types and targets.


Forces an update of the menu bar and calls MenuSelected event handlers.

Notes

In most cases, the standard menu bar updating will be sufficient. There are cases, however, when it's not. For example, if the SelChange event handler of a TextField control causes all of the menu items in a particular menu to be disabled, the menu itself should be disabled. Unfortunately, it won't be because the user has not yet clicked in the menu bar. Under circumstances like this, you can call the RefreshMenuBar method to force your app to only update the menus based on your own conditions.

Calling this calls EnableMenu or EnableMenuItem event handlers on Application, Window, ContainerControl and MenuItem.

Example

App.RefreshMenuBar

See Also

MenuItem class, Window.EnableMenuItems, MenuItem.EnableMenu events