How to understand gui handles ?
이전 댓글 표시
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.
채택된 답변
추가 답변 (1개)
댓글 수: 1
Geoff Hayes
2014년 9월 2일
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.
카테고리
도움말 센터 및 File Exchange에서 Code Execution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!