GUI data Update
Show older comments
Hi guys,
I'm building a gui in matlab and have a question about the guidata update. I want to let the user change a value on a "Edit Text" control and this value changes the current plot function. I wait until the 'return' key is pressed and process the data. The problem is that the user has to hit the return key twice to change the value. I think the guidata is not updated. Does anyone has an advice? Gerd
function txt_Faktor_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to txt_Faktor (see GCBO)
% eventdata structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
if strcmp(eventdata.Key,'return')
handles.Faktor = str2double(get(handles.txt_Faktor,'String'));
% store variable
guidata(hObject,handles);
plotMainWindow(hObject, eventdata, handles);
end
Accepted Answer
More Answers (0)
Categories
Find more on Display and Presentation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!