필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Vahini Polishetty
Vahini Polishetty 2024년 4월 2일
댓글: Vahini Polishetty 2024년 4월 3일
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.

답변 (2개)

Voss
Voss 2024년 4월 2일
편집: Voss 2024년 4월 2일
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
Voss
Voss 2024년 4월 3일
You're welcome! If you have any other questions, please let me know.
Vahini Polishetty
Vahini Polishetty 2024년 4월 3일
I'm unable to write the code to read the value of edit text in the tab for generating dynamic input boxes.

댓글을 달려면 로그인하십시오.


Taylor
Taylor 2024년 4월 2일
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
Vahini Polishetty
Vahini Polishetty 2024년 4월 2일
편집: Vahini Polishetty 2024년 4월 2일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by