How can I identify push button in app designer?

Hi! I'm creating an user interface with App Designer, and I'd like to enable a button when another button is pressed, but I don't know how i can identify the button that is pressed.

 Réponse acceptée

Elias Gule
Elias Gule le 28 Mar 2018

1 vote

Please follow the steps as outlined by the arrows in the attached picture. Basically, what you should do is
1) Select the Design View AppDesigner
2) Select the Component Whose Id You Want To Know
3) The highlighted text under the app.UIFIGUREin the Component Browser pane is the full ID of the selected component.
So if you selected a button whose text is "Select File" then in the Component Browser under app.UIFIGURE, the text app.SelectFile will be full id of the selected component.

6 commentaires

sc
sc le 28 Mar 2018
I try to explain in details what I mean: I have two buttons (like in attachements), that are called 'Select Local Folder' (in code 'app.Select_Local_Folder_Button') and 'Select Current Folder' (in code 'app.Select_Current_Folder_Button'). I'd like to enable 'Select Current Folder' when the user pushes 'Select Local Folder' and at the same time disable 'Select Local Folder' (and this is ok). The problem is that I tried to create an if cycle but code doesn't run
Elias Gule
Elias Gule le 28 Mar 2018
Modifié(e) : Elias Gule le 28 Mar 2018
The problem with your if statement is this line:
if app.Select_Local_Folder_Button == true
else
end
This will always execute the else part, because app.Select_Local_Folder_Button can never be equal to true.
try replacing it with the following:
if strcmpi(app.Select_Local_Folder_Button.Enable,'on')
%%Your other code here
else
%%Your other code here
end
sc
sc le 28 Mar 2018
I tried to do this, but when the code runs and I pushes the first button ('Select Local Folder') this button is disable (it's ok) but the second button is always enable (I'd like it to be disabled before pressing the first button)
In the createComponents method of our code, append the following code.
app.Select_Local_Folder_Button.Enable = 'off'
Will disable the button.
sc
sc le 28 Mar 2018
I put 'Current Folder' instead of 'Local Folder' and now it works!! Thank you so much!!!
Elias Gule
Elias Gule le 29 Mar 2018
xie xie!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Tags

Question posée :

sc
le 28 Mar 2018

Rouvert :

sc
le 12 Mai 2018

Community Treasure Hunt

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

Start Hunting!

Translated by