uicontrol.position=pos forgets updating the rendering if pos is unchanged but the window resized
Reported by Foad Sojoodi Farimani
ex002.7z (17.60 KB, application/x-7z-compressed)
source code
BUG DESCRIPTION:
----------------
It is a bit hard to explain this bug as it is very specific. Consider the figure object:
FigureNumber = 1002;
MainFigure = figure(FigureNumber, 'menubar_visible', 'off',...
'menubar_visible', 'off',...
'toolbar', 'none',...// 'toolbar_visible', 'off',...
'infobar_visible', 'off',...
'dockable', 'off',...
'auto_resize', 'on',...
'figure_name', 'GUI',...
'tag', 'MainFigure',...
'backgroundcolor', [0.94 0.94 0.94],...
'resizefcn', 'resizemainfigure'...
);
MainFigureAxesSize = MainFigure.axes_size;
and a n image uicontrol object:
LogoImage = uicontrol(MainFigure, 'style', 'image', 'string', get_absolute_file_path('ex002.sce') + 'logo02.png',...
'position', [0 0 50 50],...
'tag', 'LogoImage' );
and a pushbutton uicontrol object for test:
PushButtonWidth = 60;
PushButtonHeigth = 25;
StopPushButton = uicontrol(MainFigure, 'Style','pushbutton',...
'callback_type', 10,...
'String', 'Stop',...
'tag', 'StopPushButton',...
'Position', [0 MainFigureAxesSize(2) - PushButtonHeigth * 2 PushButtonWidth PushButtonHeigth],...
'callback', 'closemainfigure'...
);
there are close and resize functions:
function closemainfigure()
MainFigure = findobj('tag','MainFigure');
close(MainFigure);
endfunction
function resizemainfigure()
MainFigure = findobj('tag', 'MainFigure');
MainFigureAxesSize = MainFigure.axes_size;
StopPushButton = findobj('tag', 'StopPushButton');
StopPushButton.Position = [0 (MainFigureAxesSize(2) - PushButtonHeigth * 2) PushButtonWidth PushButtonHeigth];
LogoImage = findobj('tag', 'LogoImage');
LogoImage.Position = [0 0 50 50];
endfunction
now when resizing the figure the pushbutton position updates correctly but not the image.
now if I change the
LogoImage.Position = [0 0 50 50];
to something like
LogoImage.Position = [(MainFigureAxesSize(1) - 50) (MainFigureAxesSize(2) - 50) 50 50];
it does updates correctly.
ERROR LOG:
----------
when I put the line
disp(LogoImage.Tag)
after the line
LogoImage = findobj('style', 'image');
it returns
Attempt to reference field of non-structure array.
HOW TO REPRODUCE THE BUG:
-------------------------
use the source code in the attachment
OTHER INFORMATION:
------------------
Scilab version 6.0.2
Windows 10