how do you enable or disable a toolbar item ?
ToolItem.Enabled if you’re using a Xojo toolbar.
sorry, it should be a tool button, how to do it with a tool button ?
When you build your Toolbar and fill it with ToolItems. A ToolButton is a ToolItem, so you should be able to set it’s Enabled property.
I thought I can do something like: toolbarname.toolbuttonname.enabled = False
but toolbuttonname is unknown, where toolbuttonname means the name of the tool button.
In the debugger I can see the toolbuttonname !!!
Oh sorry, I guess you needed just a little more help.
Unfortunately Toolbar’s aren’t that easy to work with. You have to refer to the toolbar item using Toolbar.Item which is really annoying.
Use the window’s reference of the toolbar as well, not the super toolbar. In the example below referencing the window is optional. Toolbar11 is also the default name for when you drag a “Toolbar1” onto the window in the IDE.
Window1.Toolbar11.Item(0).Enabled = false
Hope that provides a little more insight
I don’t know the item -index and don’t want hardcode the index in the script.
so I probably have to use my first idea, make a copy of my toolbar and remove the unwanted tool button.
sometimes I think why is the easy way (which most users want to to) not part of the software. Xojo does a lot of new development but why not including some user friendly methods helping people to get the job done more easily.
if you know its name you can check the name of the item & find it that way
open event handler