creating uicontrol in gui without using guide
1 view (last 30 days)
Show older comments
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 Comment
Answers (1)
Jan
on 4 Feb 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.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!