UI Control callback from handles

5 views (last 30 days)
vivek patel
vivek patel on 7 May 2020
Edited: vivek patel on 7 May 2020
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 Comments
vivek patel
vivek patel on 7 May 2020
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 on 7 May 2020
@Walter, Yes you are correct sorry i wrote wrong code in the question will edit it. I am calling handles.ok_btn.Callback.

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!