UI Control callback from handles

4 ビュー (過去 30 日間)
vivek patel
vivek patel 2020 年 5 月 7 日
編集済み: vivek patel 2020 年 5 月 7 日
Edit 1: I am not asking for writing a code for a figure. I am already having the figure as a .p file. I am just running it but i want to do some simple clicks on that figure. So, while the figure is running i am starting a timer and finding the figure by the below mentioned code and going until the handle of the figure. Now my question would be how to call that call back so that it emulates the clicks.
Edit 3 : I found out that the figure is getting created by using matlab listdlg function. So, it is a list selection dialog box. So , any idea how to call a list selection dialog box callback functions ?
By using
a = findall(0,'type','figure')
I can get the figure that is currently shown. Now i want to call the callback of the figure by using handles so i do
handles = guihandles(a)
The output of the above line is as below
handles =
struct with fields:
selectall_btn: [1×1 UIControl]
cancel_btn: [1×1 UIControl]
ok_btn: [1×1 UIControl]
listbox: [1×1 UIControl]
When i enter
Edit 2 : handles.ok_btn ----> handles.ok_btn.Callback
handles.ok_btn.Callback
i get below output
2×1 cell array
@doOK
[1×1 UIControl]
My question is how i can call the doOK button callback from this handle ? Is there any other way to manipulate the figure ?
I don't have source code of the figure hence cannot change the figure but would like to automate some simple click buttons. ( I tried by touch events but that is not robust). So is there any way i can do that ?
  4 件のコメント
vivek patel
vivek patel 2020 年 5 月 7 日
Sorry i cannot attach figure as it is proprietary. The answer you provided is changing the callback function to something else. What i want is to call that callback function programatically. So, that the figure does the task accordingly. In complex GUI's i can see the function getting called with the parameters that needs to be passed for e.g.
@functionName('string',hObject,eventdata,guidata(object)) , so i can do the same and it behaves like the actual button was clicked. But not sure how to do in this case because as you can see it just gives @doOK.
vivek patel
vivek patel 2020 年 5 月 7 日
@Walter, Yes you are correct sorry i wrote wrong code in the question will edit it. I am calling handles.ok_btn.Callback.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by