We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › applet size (100x100) not code size
Page Index Toggle Pages: 1
applet size (100x100) not code size (Read 1584 times)
applet size (100x100) not code size
Apr 13th, 2010, 6:28pm
 
Why would Processing build an index.html page that doesn't use the same size(width,height) parameters as those in the sketch code? I've got two students who've done this. Paste the code in a new sketch, runs fine. Export to web applet, runs in 100x100 window....

Suggestions?
Re: applet size (100x100) not code size
Reply #1 - Apr 13th, 2010, 11:48pm
 
the values in size() must be numbers, they can't be computed values or constants.

size(640, 480); // good
size(120 * 2, 240 * 2); // bad
size(WIDTH, HEIGHT); // bad
Re: applet size (100x100) not code size
Reply #2 - Apr 16th, 2010, 8:17am
 
koogy wrote on Apr 13th, 2010, 11:48pm:
the values in size() must be numbers


Ah!! Really hmm.... I guess that makes sense, given the need to construct index.html from the source code. THANK YOU!
Re: applet size (100x100) not code size
Reply #3 - Apr 25th, 2010, 9:29pm
 
Your students probably used Code:
size(screen.width, screen.height) 

, which I use in many sketches. Its defaults to (100, 100)

I have a related question, applets in Firefox will not run at 100%, 100% after the index.html is changed from (100,100) After looking at it a while, I have realized that it is reading from
Code:

<!--[if !IE]> -->
<object classid="java:Senior_site_rect2.class"
type="application/x-java-applet"
archive="Senior_site_rect2.jar"
width="100%" height="100%"

Which is the IE section of code. Changing these works in safari and chrome

Does anyone know how to make this work?
Re: applet size (100x100) not code size
Reply #4 - Apr 26th, 2010, 12:10am
 
> Which is the IE section of code.

no, it's not. the comment above says "if !IE": if NOT InternetExplorer

and this

size(screen.width, screen.height)

is never going to work - it's the size() call that sets the screen.width and screen.height - so you're using the variables before they are set. so you get the defaults, 100x100.
Re: applet size (100x100) not code size
Reply #5 - May 1st, 2010, 9:37pm
 
Thanks for clearing up that ! means not. From my testing, only firefox uses the !IE section and safari/chrome/ie use the latter.

koogy wrote on Apr 26th, 2010, 12:10am:
>

size(screen.width, screen.height)

is never going to work - it's the size() call that sets the screen.width and screen.height - so you're using the variables before they are set. so you get the defaults, 100x100.


My question to you. Can I set a variable with javascript that reads the browser window size, and changes the width and height to the correct amount
Re: applet size (100x100) not code size
Reply #6 - May 2nd, 2010, 1:21am
 
gcolefla wrote on May 1st, 2010, 9:37pm:
From my testing, only firefox uses the !IE section and safari/chrome/ie use the latter.

I am a bit surprised... Will do my own tests! Smiley
First, you should specify what version of Processing you are talking.
Since Processing 1.1, deployment on browsers with JavaScript enabled is done via the Java deployment kit (deployJava.js). The conditional part is used only if JS is deactivated (but most people allowing Java to run also allows JS...).
Page Index Toggle Pages: 1