Help - Nested uitogglebutton State Change Callback
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Environment and Settings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!