UI Control callback from handles

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by