WebToolbar hidden item

I needed a WebToolbar with the possibility to hide some items by code based on the user’s properties.
I made my class “myWebToolbar”, as a subclass of WebToolbar with a method called “SetItemVisibilty”; now I can call that method and show or hide WebToolbar item by code.
I don’t know if there is an easier method, but this seems work fine, so I thought it could be interesting to share my class with the community, hoping this can be useful for others.

WebToolbarItemShowHide.zip

Works fine on Windows 10, thanks for sharing!

Hello Pietro,

Thank you for sharing this. Very nice!
Tim

[quote=267895:@Pietro Beccegato]I needed a WebToolbar with the possibility to hide some items by code based on the user’s properties.
I made my class “myWebToolbar”, as a subclass of WebToolbar with a method called “SetItemVisibilty”; now I can call that method and show or hide WebToolbar item by code.
I don’t know if there is an easier method, but this seems work fine, so I thought it could be interesting to share my class with the community, hoping this can be useful for others.

WebToolbarItemShowHide.zip[/quote]
Haven’t looked at the code, but are you hiding or are you removing items? I ask because just hiding means that a creative user would still have access to them through the browser’s developer tools, which could be bad if the hidden items included elevated privileges.

Thanks Greg for your contribution! Items were hide so, to make it more safe, I made a new version in which items are removed/reinserted.

What about to implement this behavior as a webtoolbar’s standard property? I think could be useful.

[quote=336615:@Pietro Beccegato]Thanks Greg for your contribution! Items were hide so, to make it more safe, I made a new version in which items are removed/reinserted.

What about to implement this behavior as a webtoolbar’s standard property? I think could be useful.[/quote]
You could file a feature request. :slight_smile: