How to get the object handle of gui which is not running and change some property??
Show older comments
Hi guys!!
I have two GUIs namely GUI 'A' and 'B'. On clicking a pushbotton on GUI A, string of editable text on GUI 'B' should be changed. I tried too many methods , but not got the desired results.
Thanks in advance..
9 Comments
Rik
on 31 Jan 2020
You need to get the handle from one GUI to the other. There are many ways to accomplish this, one of them is to have a specific tag that you can use with findobj.
Ahmed Anas
on 31 Jan 2020
Geoff Hayes
on 31 Jan 2020
Ahmed - try finding the handle to the GUI and then use that to get the handle of the edit text control.
Ahmed Anas
on 31 Jan 2020
Geoff Hayes
on 31 Jan 2020
Ahmed - what line of code are you using to do that? Are your GUIs created with GUIDE, App Designer, or programmatically?
Too complex maybe if you haven't done any OOP before, but my solution to GUIs interactibg with each other is to use a handle-derived class to act as the communication link between them. Something similar to what I laid out in this question
Not the same situation as yours, but the same idea of GUIs communicating with each other.
The idea is to have a handle-derived object that is passed to both GUIs, with a set of properties and listeners. One GUI can set a property on the object, the other GUI listens for changes to that property or for an event being triggered and reacts in whatever way it sees fit. And vice versa too if two-way communication is desired.
I imagine you just want a simple solution for this case (for me the linked approach is simple because I am used to it, but not for someone unfamiliar), but from a software engineering perspective I never like having GUIs fishing around in the handles of other GUIs and editing things, or indeed anything external to the GUI having the ability to set things!
Ahmed Anas
on 31 Jan 2020
Ahmed Anas
on 31 Jan 2020
Answers (1)
Image Analyst
on 31 Jan 2020
0 votes
See the latter portion of this FAQ entry, namely the part that says "Sharing between multiple GUIs."
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!