How to get state of the default axestoolbar buttons in UIAxes? And how to turn them on or off programmatically?
3 views (last 30 days)
Show older comments
Anders Skovlund Hansen
on 13 Oct 2020
Commented: Mario Malic
on 13 Oct 2020
Hi,
I have a plot with a callback function 'buttonDownFcn' that applies the area function to plot a tranparent square on top of the data. I don't want my callback function to run if any of the default state buttons are pressed.
How to get the state of the default buttons of the axestoolbar in UIAxes?
Another workaround is to create an extra button that, when enabled, enables the callback function. But unfortunately I still need set the state of the other default buttons to 0 if the have been pressed previously, otherwise they will interfear with my callback function.
I have just upgraded to R2020b where Mathworks have added more supported features to UIAxes when comparing to R2019b, but I know that there still are some limitations and not supported features in UIAxes, e.g. buttons and availabe callback functions...
So maybe it is not yet possible to "read" the button state values of the axestoolbar in UIAxes?
Any help is apriciated!
Regards Anders.
1 Comment
Accepted Answer
Mario Malic
on 13 Oct 2020
Edited: Mario Malic
on 13 Oct 2020
Hi Anders,
- Looks like there's a possibility of changing the button state on toolbar.
app.PulsePlotUIAxes.Toolbar.Children(2).Value = 'off'
% ^ Axes handle you're ^ There are 8 children in standard toolbar
% interacting with so you have to do this command for every single one of them
First child is a toolbardropdown and it doesn't have the Value property, so there's no need to change it.
- You can try temporarily disabling interactions in your buttonDownFcn (but I am not sure if that's going to work since toolbar buttons are independent of interactivity). Here's an answer how to disable interactivity.
- Maybe you could add a button to the toolbar that executes a callback, that way you are sure that none other button has been selected. toolbar button
More Answers (0)
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!