Description
The Clear
method is a public instance method of the Editor.ToolBar
class. It is used to remove all options, widgets, and separators from the toolbar, effectively resetting it to an empty state. This can be useful when you need to dynamically change the contents of a toolbar during runtime.
Usage
To use the Clear
method, you must have an instance of the Editor.ToolBar
class. Simply call the method on the instance to clear all its contents.
Example
// Create an instance of the ToolBar
Editor.ToolBar myToolBar = new Editor.ToolBar();
// Add some options to the toolbar
myToolBar.AddOption("Option 1", "icon1.png", () => { /* Action for Option 1 */ });
myToolBar.AddOption("Option 2", "icon2.png", () => { /* Action for Option 2 */ });
// Clear all options from the toolbar
myToolBar.Clear();
// At this point, the toolbar is empty and can be repopulated with new options or widgets.