Figure window transitions (screen transitions - GUI design)
2 views (last 30 days)
Show older comments
Hi. My idea is building a logo image (similar to Matlab's startup one) which shows before my gui is appeared. I have the following code, which was obtained modifying the solution given by MathWorks, for it:
% create a figure1 that is not visible yet, and has minimal titlebar properties
fh = figure('Visible','off','MenuBar','none','NumberTitle','off',...
'DockControls','off');
% put an axes in it
ah = axes('Parent',fh,'Visible','on');
% put the image in it
ih = imshow('SIS.gif','Parent',ah);
% set the figure1 size to be just big enough for the image, and centered at
% the center of the screen
imxpos = get(ih,'XData');
imypos = get(ih,'YData');
set(ah,'Unit','Normalized','Position',[0,0,1,1]);
figpos = get(fh,'Position');
figpos(3:4) = [imxpos(2) imypos(2)];
set(fh,'Position',figpos);
movegui(fh,'center')
% make the figure1 visible
set(fh,'Visible','on');
pause(3);
close(fh);
I have two problems:
#1: I want the logo image's figure windows has no borders, no title and no taskbars. I have tried the WindowAPI but it does not work because I call it after the above code and because of the visibility of the window is off, then the handle of it is off too.
#2: I want that, when the logo image is disappeared, it is showed the gui window mazimized. Where is the problem? The screen transition between the logo image's window and the gui window is not smoothed. I have tried to use a lot of Matlab´s applications that I found in FEX (WindowAPI, Maxfig, Maximize, SetFigTransparency,...) without success. I realized that the problem is the visibility of my gui (I set off until all elements are created and then I change it to on). Because of the off visibility cause the handlevisibility is off too, the previous mentioned applications has no effects on the figure window that I want to maximize.
After observating the startup of Matlab, I have noticed that after the logo is showed, it appears a fullscreen image followed by the normal fullscreen of the program. So I have tried to create an maximized fullscreen windows that appears after the logo's windows is closed. However, now the problem is the transition between this last and the gui window. If I set the visibility of the gui window on and then I maximize it, during an instant it can be seen that transition that bothers me. I do not know what to do. I also think that if I could avoid that the guide window is currentfigure when I change its visibility, perhaps I would achieve it. Other solution it might be a timer that hold on the white window as currentfigure while the guide window is behind changing its visibility but I do not know how to do. Thank you for your attention.
2 Comments
Paulo Silva
on 9 Jun 2011
you have a big problem there, it's way above my experience with MATLAB so I can't help you but I'm voting on your question and looking for tips from the experts :) good luck
Accepted Answer
More Answers (2)
Jan
on 9 Jun 2011
You can use WindowAPI by creating the figure with enabled visibility, but outside the screen, e.g.:
FigH = figure('Position', [-1000, -1000, 200, 200], ...
'Color', zeros(1, 3));
axes('Units', 'normalized', 'Position', [0.4, 0.4, 0.2, 0.2]);
sphere;
WindowAPI(FigH, 'Alpha', 0, uint8([0,0,0]));
WindowAPI(FigH, 'fullscreen');
WindowAPI(FigH, 'topmost');
This is not exactly "figure windows has no borders, no title and no taskbars", but you can see only the axes contents.
Robert Cumming
on 9 Jun 2011
This is as close as I have got so far on this one:
screenSize = get(0,'ScreenSize'); d = dialog ( 'WindowStyle', 'normal', 'visible', 'off', ... 'position', [0 0 screenSize(3), screenSize(4)] ); uicontrol ( 'parent', d, 'style', 'text', ... 'string', 'myTest', 'units', 'normalized', ... 'position', [0.4 0.4 0.1 0.1] ); drawnow() % Start to create Your SplashScreen img = imread('splash.png'); jimg = im2java(img); frame = javax.swing.JFrame; frame.setUndecorated(true); icon = javax.swing.ImageIcon(jimg); label = javax.swing.JLabel(icon); frame.getContentPane.add(label); frame.pack; frame.setSize(screenSize(3),screenSize(4)); frame.setLocation(screenSize(3),screenSize(4)); frame.show; pause(3) frame.dispose; set ( d, 'visible', 'on' ) pause(4); close(d)
Mathworks support has a page about splash screens as well.
3 Comments
Robert Cumming
on 10 Jun 2011
it should show the image for 3 seconds, which then disappears and is replaced with you GUI.
You did change the filename on the line: img = imread('splash.png'); ?
See Also
Categories
Find more on Interactive Control and Callbacks 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!