Get the edit field for which a context menu was opened

I have a MATLAB UI that I am using the App Designer to use. On the UI, I have multiple Edit Fields, all of which I want to have the same Context Menu. However, when the Context Menu option is selected, I need to know which Edit Field was selected. How do I get which field was right clicked on?
I have tried just using the event source, but that returns the Context Menu object, not the Edit Field that was clicked on
% Menu selected function: AddChannelMenu
function AddChannelMenuSelected(app, event)
field_num = str2double(event.Source.Tag);
add_channel(app,field_num);
end

4 commentaires

There was a question, I think it was identical one, but the solution wasn't really user friendly. Can you check UIFigure's property of your app, SelectedObject, it might return the Edit Field component.
Cris LaPierre
Cris LaPierre le 20 Déc 2020
Modifié(e) : Cris LaPierre le 20 Déc 2020
You can find the post Mario may be referring to here.
The UIFigure doesn't appear to have a SelectedObject property, so I don't think your suggestion will work Mario. As for the previous posting, I wasn't able to get anywhere with it because there is no ClickedOn callback for EditFields.
Mario Malic
Mario Malic le 21 Déc 2020
Modifié(e) : Mario Malic le 21 Déc 2020
Then Cris' comment will help you.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Produits

Version

R2020b

Question posée :

le 18 Déc 2020

Modifié(e) :

le 21 Déc 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by