FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   HScroll bar
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: HScroll bar  (Read 532 times)
Armageddon


HScroll bar
« on: Oct 24th, 2004, 2:50am »

ok heres my problem
 
i put this in my code window
 
HScrollbar hs1;
int topWidth, bottomWidth;
 
void setup()
{
 hs1 = new HScrollbar(0, 20, width, 10, 3*5+1);  
}
 
And before it even gets to the void setup() it displays this error
 
Type HScrollbar not found.
 
(in the console/output area at bottom)
 
C:/Danny/Program Files/processing-0068/lib/build/Temporary_1068_3110.java:1:657:1:666: Semantic Error: Type HScrollbar was not found.
C:/Danny/Program Files/processing-0068/lib/build/Temporary_1068_3110.java:5:12:5:21: Semantic Error: A candidate for type "HScrollbar" was found, but it is invalid and needs to be fixed before this type will successfully compile.
 
I'm sorry if i included to much or to litte information if you need more just hollar
 

I'm a newb. Bare with me.
Who's Yo Daddy now New York!?
fjen

WWW
Re: HScroll bar
« Reply #1 on: Oct 24th, 2004, 6:49am »

that's because you forgot to put the HScrollbar class into the sketch. copy everything from:
class HScrollbar
{
... to the last
}
 
from the example into your sketch.
 
HScrollbar is not an buildin object. it's build (described) by everything inside the class statement. that way you can model your own objects to use ...
 
here's another simple example:
http://processing.org/learning/tutorials/a_simpleclass.html
 
folks: ain't there a processing class tutorial online somewhere?
 
/F
 
if you're really curious, here's what sun's tutorial says:
http://java.sun.com/docs/books/tutorial/java/javaOO/classes.html
« Last Edit: Oct 24th, 2004, 6:50am by fjen »  
Armageddon


Re: HScroll bar
« Reply #2 on: Oct 24th, 2004, 6:51pm »

 Im sorry if im becomming a nag but i seem to have difficulty getting the scroll bar to appear.  Ive tried fill commands and ive played with all the values in the () and nothing seems to show up on the screen(it just shows the background i set before i called the scrollbar).
 
 
  I realy need to get it working cause im trying to come up with something cool to catch the eyes of the members of my school's Programming Club.  If they like it enough we will try to take some club time to explore Proccessing. Thanks for your help
 
EDIT
 
Almost for got to thank you for replying in the first place!
« Last Edit: Oct 24th, 2004, 6:52pm by Armageddon »  

I'm a newb. Bare with me.
Who's Yo Daddy now New York!?
fjen

WWW
Re: HScroll bar
« Reply #3 on: Oct 24th, 2004, 9:28pm »

ok, the programming club. i wish we'd done programming back then - i did pascal .. ahh.
 
anyway. why don't you just show some of the examples from the processing site? .. or search the forum for some nice examples?
 
fill() set's the current fillcolor, consider it the same as choosing a color for fill-ins but not (yet) using it. so it's a setting-function not a drawing-function. this current fill-color is used to fill any forms (rects, ellipses, ..) you draw to the window later on. to fill the whole window with a color you'd do background().
 
see:
http://processing.org/reference/fill_.html
http://processing.org/reference/stroke_.html
http://processing.org/reference/background_.html
 
here's the scrollbar example using fill and background:
Code:

HScrollbar hs1;
 
void setup()
{
  size(200, 200);
  noStroke();
  hs1 = new HScrollbar(0, 20, width, 10, 3*5+1);
}
 
void loop()
{
  float topPos = hs1.getPos()-width/2;
  topPos %= 255.; // make sure it's between 0. - 255. //
  background(topPos);  // fill background
   
  fill(color(topPos, 255-topPos, 0));    // set fill color
  stroke(color(0, topPos, 255-topPos));  // set outline color
  rect(30,30, width-60, height-60);
   
  hs1.update(); // checks with the mouse ...
  hs1.draw();   // redraws the scrollbar
}
 
// include class HScrollbar from the example here !
// class HScrollbar { ...

 
best, /F
 
Igorius

WWW
Re: HScroll bar
« Reply #4 on: Oct 25th, 2004, 7:18pm »

Hi Armageddon,
 
I wrote a simple scrollbar class that you can find at
http://perso.wanadoo.fr/s-e-b/Java/Applets/slider/scrollbar.html
 
It returns a relative value that you can use for whatever you want, as in this example:
http://perso.wanadoo.fr/s-e-b/Java/Applets/particule/particule.html
 
Seb
 
Armageddon


Re: HScroll bar
« Reply #5 on: Oct 25th, 2004, 10:43pm »

I feel so dumb i never told it to draw!!
Thanks Both of you I fianly understand this whole scroll bar thing!
 
One thing how can Float topPos be a background if its not a color variable?
 
EDIT
 
I jsut checked out that program you made and it looked AWESOME the implications for a scrollbar seem limitless!
« Last Edit: Oct 25th, 2004, 11:08pm by Armageddon »  

I'm a newb. Bare with me.
Who's Yo Daddy now New York!?
Igorius

WWW
Re: HScroll bar
« Reply #6 on: Oct 26th, 2004, 12:09am »

on Oct 25th, 2004, 10:43pm, Armageddon wrote:

 
One thing how can Float topPos be a background if its not a color variable
 

 
I do not quite understand your question. Could you be more specific
 
fjen

WWW
Re: HScroll bar
« Reply #7 on: Oct 26th, 2004, 12:29am »

well sometimes it helps looking at the links i put ..
 
background(topPos);  // fill background
 
this assumes topPos to be a grey value. it is (depending on the colormode) the same as saying:
 
background( color(topPos, topPos, topPos) );
 
sorry if this confused you ..
 
http://processing.org/reference/background_.html
http://processing.org/reference/color_.html
 
/F
 
Pages: 1 

« Previous topic | Next topic »