Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

Subject: Slider values
From: mwforum@xxxxxxxxxxxxxxxxxx (Mike Sandy)
Date: Thu, 11 Sep 2003 20:00:34 +0100

To get rational values from a slider, the slider value
has to be multiplied by a factor. No problem there,
but the slider displays only  integer values.
The factor * slider value can be shown 
and updated as the slider is moved, by
using a transparent textbox. Since the procedure
runs as an independent process this can slow down
other processes, but by introducing  WAIT into the
slider procedure the effect becomes insignificant.
The slider name can be shown with another transparent
textbox, CG can then be used safely.
In the program press the "sliders" button then change the 
sliders' values.

 :slider - the slider's name e.g "velocity
 :tbox - the textbox name to show the factor * slider value
 :f - the factor

to sl-value :slider :tbox :f
 let[val 0 ]
  [if not :val = get :slider "value
    [make "val get :slider "value
     tto :tbox
     hidetext opaque :tbox
     ct pr :val * :f  ; OR ANY OTHER FUNCTION
     transparent :tbox showtext 
    ]wait 1 

to sliders
 sl-value "velocity "velocity-txt 10
 sl-value "height "height-txt 5


Attachment: slider-values.mw2
Description: Binary data

  • Previous by thread: rotating shapes
  • Next by thread: Looking for a Life Science Project

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.

    © copyright 2001 - 2008