x


2 HorizontalSliders one slides the other doesnt'

The title pretty much sums it up. I have two sliders stacked and the top one will slide but the bottom one won't. The bottom one's slider glows when you mouse over it in the simulator, but doesn't slide.

Maybe the simulator, maybe my code:

    // Initial Velocity
GUI.Label(Rect(3,300,200,50), "Initial Velocity");
velMagnitude = GUI.HorizontalSlider(Rect(3,320,200,100),velMagnitude,0.0,500.0);
GUI.Label(Rect(220,320,20,20), velMagnitude.ToString());

// New theta slider
GUI.Label(Rect(3,360,200,50), "Theta");
newTheta = GUI.HorizontalSlider(Rect(3,380,200,50),newTheta,0.0,90.0);
GUI.Label(Rect(220,380,20,20), newTheta.ToString());
more ▼

asked May 20 '10 at 01:52 PM

rd42 gravatar image

rd42
296 30 37 46

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Well, I should have counted to 10 and kept trying, but maybe this will help some one else out. The vertical size of the rect for the first slider was overlapping the bottom one. Here's the fix:

    // Initial Velocity
GUI.Label(Rect(3,300,200,50), "Initial Velocity");
velMagnitude = GUI.HorizontalSlider(Rect(3,320,200,20),velMagnitude,0.0,500.0);
GUI.Label(Rect(220,320,20,20), velMagnitude.ToString());

// New theta slider
GUI.Label(Rect(3,360,200,50), "Theta");
newTheta = GUI.HorizontalSlider(Rect(3,380,200,20),newTheta,0.0,90.0);
GUI.Label(Rect(220,380,20,20), newTheta.ToString());
more ▼

answered May 20 '10 at 01:58 PM

rd42 gravatar image

rd42
296 30 37 46

(comments are locked)
10|3000 characters needed characters left

where are you defining the variables "velMagnitude" and "newTheta"? it sounds like you may be defining velMagnitude in the class body, but newTheta only within the scope of the local function, so when the function ends it is forgotten and re-created afresh next time round (with the same initial value).

more ▼

answered May 20 '10 at 01:58 PM

duck gravatar image

duck ♦♦
40.9k 92 148 415

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x19

asked: May 20 '10 at 01:52 PM

Seen: 758 times

Last Updated: May 20 '10 at 01:52 PM