clear listbox in gui

I have a listbox in gui that display the result of execution... when I want to run another time I want the past resut in listbox to be removed and display the message(please wait the result)and then the new result is display i just dont know how to clear the listbox and display that message.

Respuestas (2)

Image Analyst
Image Analyst el 15 de Dic. de 2017

0 votos

Did you try to set it to null?
handles.listbox1.String = [];

5 comentarios

marwa marwan
marwa marwan el 16 de Dic. de 2017
it didnt work
Image Analyst
Image Analyst el 16 de Dic. de 2017
Yes it does. I just tried it myself to make sure. It works fine. It immediately clears out the listbox.
Are you sure the tag property of your listbox is used right after "handles." and before ".String"? Yours is probably not named listbox1 so make sure you use the right name.
Otherwise, post your m-file and .fog file so I can replicate the strange, inexplicable behavior of your GUI.
marwa marwan
marwa marwan el 17 de Dic. de 2017
thanks for your interest..i solved it by using waitbar when the program is under execution and then the result is appear in listbox..thus there is no need to delete the past execution. I appreciate your help
Image Analyst
Image Analyst el 17 de Dic. de 2017
Using a waitbar is not required for clearing a listbox. That's a totally separate issue. Perhaps you cleared it and immediately went into a computationally intensive loop and so the screen did not refresh. To have it refresh immediately, use drawnow.
handles.listbox1.String = [];
drawnow;
marwa marwan
marwa marwan el 18 de Dic. de 2017
I know its separate issue but I just didnt know why my list box didnt refreshed so I used wait bar just to knowledge the GUI user that the program is under execution thank you for explination that is exactly what I want..

Iniciar sesión para comentar.

Hossein Davari
Hossein Davari el 5 de Mzo. de 2021

0 votos

ListBoxHandle.Items = {}; %clear the list of items in listbox
edg = errordlg('Message');
waitfor(edg) %program will continue when the dialog box is closed.
drawnow

2 comentarios

Walter Roberson
Walter Roberson el 5 de Mzo. de 2021
Items is, I suspect, for list boxes in app designer.
Hossein Davari
Hossein Davari el 5 de Mzo. de 2021
Yes

Iniciar sesión para comentar.

Categorías

Más información sobre App Building en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Dic. de 2017

Comentada:

el 5 de Mzo. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by