Help - Nested uitogglebutton State Change Callback
Afficher commentaires plus anciens
In matlab i have a nested uitogglebutton object. like this: fig > uipanel > uigridlayout > uibuttongroup > uitogglebutton. Because the toggle button is contained within uibuttongroup, uitogglebutton callabacks are not allowed. However, uibuttongroup SelectionChangedFcn fires callback if different button within buttongroup is selected and not toggle button state change. (Note: uicontrol with togglebutton not allowed when using uigridlayout). So, how do I detect a uitogglebutton state change and perform callback? Appreciate any help you can provide!
PseudoCode:
fig = figure(...)
panel = uipanel(fig, ...)
grid = uigridlayout(panel, ...)
btngrp = uibuttongroup(grid, ..., 'SelectionChangedFcn',selectionFcn)
tglbtn = uitogglebutton(btngrp, ...) %% callback not allowed on state change
function selectionFcn(src, event) %% Function not executed if togglebutton state change
selectedBtn - src.SelectedObject
if selectedBtn.Value == 1
DoSomething
else
DoSomethingElse
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!