How to specify a callback function for the CellSelectionCallback property for runtime created Tables in App Designer?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
In App Designer:
Suppose that a TabGroup is created in App Designer's Design View, and that new tabs are simply added at runtime:
hTab = uitab(app.TabGroup,'Title',name_string);
Then suppose that a table is created as a child of the new tab, with a function specified for the CellSelection callback:
hTable = uitable(hTab,'CellSelectionCallback',@TableCellSelection);
The function TableCellSelection(app,event) is a private method in the app.
When the user selects some region of a successfully populated table, the following error results:
Undefined function 'TableCellSelection' for input arguments of type 'matlab.ui.control.table'.
Am I using an incorrect approach, or is this possibly a bug? Thanks.
0 commentaires
Réponses (1)
Kevin Holly
le 26 Juil 2023
MrToad,
It seems like MATLAB cannot locate the function. You could call the function from outside the app. Please see the app and script attached.
In the example attached, I called the function with app as an input:
hTable = uitable(hTab,'CellSelectionCallback',{@TableCellSelection app});
To test to see if the function works, I had it make a label visible.
function TableCellSelection(table_handle,events,app)
app.CellSelectionworksLabel.Visible = "on";
end
0 commentaires
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!