Filter löschen
Filter löschen

How to give call back function in app design using MATLAB.

1 Ansicht (letzte 30 Tage)
Vahini Polishetty
Vahini Polishetty am 2 Apr. 2024
I'm creating an app in app design using MATLAB. I want to give call back function for the edit text value in MATLAB. Let me give brief explanation of my work. In the design view, i have editnumeric field named as "Number of Tabs" and enter button. whereas in the editnumeric field if I give numeric value as 3 and clicked on enter button. Then i'm getting 3 tabs. In each tab there is, Number of Boxes : "input box to enter value" ---> "enter button". If i click on "enter button" after giving value in "input box" that describes number of boxes, i should get that many input boxes in that tab and it should be dynamically vary from each tab.[e.g: In tab 1 - Number of Boxes: "3" ---> clicked on enter button---> 3 input boxes should generate]. I want to give call back function to the 'enter buttom' which is in tab section so that i can generate input boxes based on the input value i have given in the number of boxes.

Antworten (2)

Voss
Voss am 2 Apr. 2024
Bearbeitet: Voss am 2 Apr. 2024
Since the editfield for number of boxes and the enter button for getting dynamic input boxes are created programmatically, specify their callbacks programmatically.
For instance, if your code that creates an editfield looks like:
new_edit = uieditfield(p,'numeric','Value',0)
then just include a ValueChangedFcn in the arguments:
new_edit = uieditfield(p,'numeric','Value',0,'ValueChangedFcn',@cb_edit)
and define the calback function cb_edit appropriately.
Or, if you are using copyobj to create the new ui components, you can specify their callbacks after they are created, e.g.:
new_edit = copyobj(old_edit,p); % create the thing
new_edit.ValueChangedFcn = @cb_edit; % then set its callback
  3 Kommentare
Voss
Voss am 3 Apr. 2024
You're welcome! If you have any other questions, please let me know.
Vahini Polishetty
Vahini Polishetty am 3 Apr. 2024
I'm unable to write the code to read the value of edit text in the tab for generating dynamic input boxes.

Melden Sie sich an, um zu kommentieren.


Taylor
Taylor am 2 Apr. 2024
To add a callback to a component, open the app in design view. Right-click the component you want to add a callback for and select the appropriate option from the menu. It sounds like you will want a ValueChangedCallback. Once you select the type of callback from the menu, you will automatically be brought to the location of the callback in code view.
  1 Kommentar
Vahini Polishetty
Vahini Polishetty am 2 Apr. 2024
Bearbeitet: Vahini Polishetty am 2 Apr. 2024
Thanks for your response. Editfield for number of boxes and the enter button for getting dynamic input boxes won't be in the design view. Those are the responses after the code runs. Only Number of tabs and enter button is available in design view.I think I'm clear about my question.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by