We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi Quark,
I know you've had your hands full with updates to the new G4P since Processing 3 came out. I presume that you just haven't gotten around to adding the resizing ability for GWindows in the new release of G4P?
If it's there, please point me to the correct method to use, I'm not seeing one. :) Otherwise, take this as a friendly/patient up-vote for the feature.
Thanks! Rudnik
Answers
Just spotted this discussion.
I don't remember being asked to add this feature and there are no tickets on Sourceforge asking for this either.
Resizing a GWindow probably won't be straight forward especially with Processing 3 but I will investigate the possibility.
If you have a GWindow called
window
then you can usewindow.getSurface().setResizable(true);
According the the Processing 3 docs this is not enabled by default because "'because most sketches won't behave well when resized"
So this is not a feature I am likely to implement in G4P
An interesting point is we can't directly access field surface from another class outside the main sketch.
B/c they've decided outta the blue that surface should be
protected
.Even though the old frame was
public
. 8-|Dunno what exactly we're being
protected
from.But now only the "getter" getSurface() is guaranteed to work at all times.
It is protected from being changed directly with
But you can still access surface with
getSurface()
and you can access it directly by inheriting from the PSurface class. This is good OO designThis was poor OO design
So things are improving ;)
How does that work? Since sketches are subclasses of PApplet, surface can be directly accessed! >:)
It's only when dealing w/ "foreign" classes that annoying
protected
access level kicks in! ~X(So for 99% of times, it doesn't protect anything. Only gets in the way for more complex sketches! 8-}
You are right I forgot that because I had been thinking of how I access it in G4P. The answer is to make it
private
orfinal
(if practical) and keep the publicgetSurface()
method. This will protect thesurface
variable being changed and thegetSurface()
method is likely to be inlined by the JVM.Apart from assigning
null
to surface, I got no idea how to create a PSurface for it! :))No 1 reassigns surface ever. We don't need that kinda "protection"! [-X
Thanks for looking into Quark-- I hadn't realized I had to go through the getSurface method to access it. SetResizable was one of those things I used with P2. I think this actually answers several other questions I had in regard to GWindow and PApplet in P3. Your hint has already helped me figure out why frame.setAlwaysOnTop(true) wasn't working anymore ;)
Also, Happy New Year