creating uicontrol in gui without using guide

10 visualizaciones (últimos 30 días)
luis fonseca
luis fonseca el 3 de Feb. de 2011
I made a gui using guide. But in my .m gui I need to create a uicontrol but not using guide. The problem I have is that when I create a uicontrol('Style','Edit','Position',[Posx,Posy,w,l]) it plots the uicontrol well, but when I change the position the previous uicontrol is still seen, therefore I have two uicontrols, it seems it does not update the uicontrol and just creates new ones everytime I press a callback button to update the position. If I use the uicontrol in guide it does not show this problem, but I dont want to create it from guide, I will like the user to create a uicontrol if he needs too.
Regards Diego
  1 comentario
Matt Fig
Matt Fig el 3 de Feb. de 2011
Where in your code are you calling UICONTROL to create the editbox?

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 4 de Feb. de 2011
You can move the UICONTROL:
Pos = [0.0, 0.0, 0.1, 0.04];
EditH = uicontrol('Style', 'edit', ...
'Units', 'normalized', ...
'Position', Pos);
for i = 1:100
Pos(1:2) = [rand * 0.9, rand * 0.96];
set(EditH, 'Position', Pos);
drawnow;
pause(0.5);
end
If your program creates new UICONTROLs, when a callback runs, it (sorry) creates new UICONTROLs instead of moving the existing one. Please inspect (or post here) the code used for the intentional moving.

Categorías

Más información sobre App Building en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by