How to understand gui handles ?
Ältere Kommentare anzeigen
Hello,
I'm programming a GUI. I need help by understanding how handles are working. This is simple code :
Starting creating a Structure S. Storing my figure into it.
S.f = figure('Position', [400,400,1000,400], ...
'Name', 'Store data');
Storing an edit box and a pushbutton.
S.eT_name = uicontrol( 'Style', 'edit', ...
'Position', [400,100,200,50], ...
'FontSize', 15, ...
'BackgroundColor', 'white');
S.pB_save = uicontrol( 'Style', 'pushbutton', ...
'String', 'Save', ...
'Position', [700,75,200,50], ...
'FontSize', 20, ...
'BackgroundColor', 'red');
Setting callbacks.
set(S.pB_save, 'Callback', {@pB_save_callback, S});
set(S.eT_name, 'Callback', {@eT_name_callback, S});
Here are the 2 Callback functions.
function [] = eT_name_callback(hObject, eventdata, S)
s_Name = get(hObject, 'String');
set(S.data, 's_Name', s_Name);
guidata(S.f, S.data);
function [] = pB_save_callback(hObject, eventdata, S)
display(S.data);
My questions are :
- How can i save the string, that I'm getting by the edit box, into my GUI so that I can display it by clicking on the pushbutton ?
- I supposed S is the guihandle, isn't it ? Is there a solution so that i can create for example an array into the GUI to save data ?
Thank you in advance.
Akzeptierte Antwort
Weitere Antworten (1)
1 Kommentar
Geoff Hayes
am 2 Sep. 2014
Adrien - please create a new question for this problem as it does not relate to the first one. As well, describe in more detail what you are trying to accomplish.
Kategorien
Mehr zu Code Execution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!