How do I use pre-defined data in *_CreateFcn calls in GUIDE?
Show older comments
Hello,
I am a self-described 'modest' Matlab programmer and have recently started coming back up to speed on GUIDE for my work.
My situation is that I have roughly three dozen components on my GUI, and I would like to have a large number of them initialized based on 'pre-defined' data that I have hard-coded somewhere in a central location. I say central as I would like to use some pieces of data be used to initialize multiple components. A quick example of what I want is if I had two text boxes on my GUI:
function text_box1_CreateFcn(hObject, eventdata, handles)
set(hObject, 'string', handles.paramA)
function text_box2_CreateFcn(hObject, eventdata, handles)
set(hObject, 'string', handles.paramA)
Where handles.paramA has been set 'before' the code gets to this point.
Further Discussion
I know that I can do what I want by setting both text boxes in the OpeningFcn() function with:
set(handles.text_box#, 'string', handles.paramA)
but you can imagine that OpeningFcn() would get quite large as I have significantly more than two components to set, and some of the initialization I am doing involves blocks of logic rather than just single lines. Is this route my best bet? I think the crux of my problem is that all CreateFcn() calls are executed before OpeningFcn(), correct?
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown 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!