Set Toolbar Item Pushed State

I see how to set a toolbar item’s pushed state via the IDE, but how do I set it via code? I have checked the documentation but didn’t find anything that would point me in the right direction. To clarify: I’m speaking specifically of the pushed state of toggle buttons in a toolbar.


WebToolbarButton.Toggled = Not WebToolbarButton.Toggled

That appears to be only for web-based forms and I’m coding a desktop app. I should have clarified that. Sorry.

This code will push a toggle button on a desktop toolbar. I just put it in the Open event handler of the Toolbar on the window:

ToolButton(Me.Item(0)).Pushed = True
ToolButton.Pushed = Not ToolButton.Pushed

It must have a Style of ToolStyleToggleButton.

Ah… thanks for the info. Just tried it out and it worked exactly as I expected. Much appreciated.

Does this not work for Cocoa builds? It seems to not have any effect on the toolbutton when setting the style to ToolStyleToggleButton and the pushed to true.

It looks like the Pushed property in the Inspector is not doing anything.

Setting it via code (see posts above) seems to work fine, though.