how to make after fill in the second edit text gui then the process will proceed?
Mostrar comentarios más antiguos
hi all, in my GUI, i have two edit text box that will require the user to fill in the model number and serial number. how i want to do it if only both of the edit text box is filled, then the process will proceed.if either one is not filled, a pop up message will ask the user to fill in.
thank you.
9 comentarios
Rik
el 18 de Mayo de 2018
Use get to obtain the String properties of both edit boxes, and use isempty to find out if they are filled.
NUR SHOLIHAH RAMLEE
el 18 de Mayo de 2018
Editada: Jan
el 18 de Mayo de 2018
Jan
el 18 de Mayo de 2018
@NUR SHOLIHAH RAMLEE: Whenever you mention in the forum, that you get an error, post a copy of the complete message. It is easier to fix an error than to guess, what the error is.
Rik
el 18 de Mayo de 2018
Please use the {}Code button to properly layout your code so it is readable and can be copy-pasted to Matlab:
content_str = get(handles.ModelNum,'String');
t_string = get(handles.SerialNum,'String');
if isempty(content_str)
errordlg('Please enter Model Number');
end
if isempty(t_string)
errordlg('Please enter Serial Number');
end
What error does this code give you?
NUR SHOLIHAH RAMLEE
el 21 de Mayo de 2018
Rik
el 21 de Mayo de 2018
Apparently the string was not empty. Did that field contain spaces? You could try to wrap it in strtrim to remove whitespace.
NUR SHOLIHAH RAMLEE
el 21 de Mayo de 2018
Rik
el 21 de Mayo de 2018
From what you have shown, there is no reason why this code should not detect an empty field. So again: are you sure the field is really empty and does not contain any whitespace characters?
NUR SHOLIHAH RAMLEE
el 22 de Mayo de 2018
Respuestas (0)
Categorías
Más información sobre Language Support en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
