Proportional GUI
Ältere Kommentare anzeigen
Hi everybody, I am working on a project where there is a GUI with buttons, edit-box, images...
I am working with my notebook, but I also need to use this application on others computers, that surely have different monitor.
I set inside Property Inspector, under Position a dimension in PIXEL of 1024x768. Anyway, if I set GUI as proportional, the size fill the monitor.
That is ok, but I would like to open the .exe and immediately fill the screen, as if I pressed the resize button on the upper left hand side.
How can I set this aspect?
Thanks
Antworten (9)
Aurelien Queffurust
am 19 Sep. 2011
One possible solution:
jFrame = get(handle(gcf),'JavaFrame');
jFrame.setMaximized(true);
The official TMW Tech note: How do I make a figure full screen programmatically in MATLAB 7.7 (R2008b)?
3 Kommentare
Jan
am 19 Sep. 2011
+1. As long as Matlab supports the JavaFrame property, this is a nice platform-independent solution. If you rely on this feature, it might be helpful to vote here: http://www.mathworks.com/support/contact_us/dev/javaframe.html . I'm afraid the feature could be removed in Matlab 8, when the new HG-objects are enabled, but this is *pure guessing* based and *not* based on real information. I'd really prefer to see the JavaFrame property documented and supported.
Ocram
am 19 Sep. 2011
Jan
am 19 Sep. 2011
@Ocram: "Doesn't work" is not precise enough to find out, where the problem is. The code needs Java, so e.g. it fails when Matlab is started with the -nojvm flag. Or perhaps GCF does not point to the wanted figure?
Jan
am 19 Sep. 2011
Note that a full screen GUI looks overwhelming on a 27''-monitor. Therefore I'm using this to limit the size:
FigH = figure('Units', 'normalized', ...
'Position', [0,0,1,1], ...
'Visible', 'off');
set(FigH, 'Units', 'pixels');
FigPos = get(FigH, 'Position');
FigExt = min(FigPos(3:4), [1024, 768]);
set(FigH, 'Position', [FigPos(1:2), FigExt]);
set(FigH, 'Units', 'normalized');
Ocram
am 19 Sep. 2011
0 Stimmen
Aurelien Queffurust
am 19 Sep. 2011
0 Stimmen
You may also try these P-codes : Is it possible to maximize, minimize or get the state of my figure programmatically in MATLAB?
1 Kommentar
Jan
am 19 Sep. 2011
The P-files contain your JavaFrame approach and some checks of the inputs. The different files concerning the Matlab version differ in the P-coding only.
Ocram
am 19 Sep. 2011
0 Stimmen
2 Kommentare
Jan
am 19 Sep. 2011
Perhaps the figure size is set later again? You can use the debugger to find this.
Jan
am 19 Sep. 2011
Perhaps the figure size is set later again? You can use the debugger to find this.
MAXFIG fails if the figure is not visible. Therefore I'd use the [0,0,1,1] position in normalized coordinates.
Ocram
am 19 Sep. 2011
Aurelien Queffurust
am 19 Sep. 2011
0 Stimmen
As Yair suggests in his comment June 7, 2011 at 1:47 am try to put the maxfig call in the outputfcn intead of opening fcn
Ocram
am 24 Sep. 2011
1 Kommentar
Image Analyst
am 24 Sep. 2011
Any idea about what? What about those two lines???
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!