PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Jonathan Bristow on November 11, 2006, 11:14:32 AM

Title: Slider Control
Post by: Jonathan Bristow on November 11, 2006, 11:14:32 AM
Does anyone know how i can set the Slider Position at the Form_create stage?
Reading back the nPosition is easy in the hscroll callback.  :)
Title: Slider Control
Post by: TechSupport on November 11, 2006, 06:54:53 PM
Hi Jonathan,

The initial slider position can be set using the "Value" property at design time (you probably already know that). :)

You can set the values in the WM_CREATE message handler as follows (This sets a slider with min 1, max 10 and a position of 5.

   SendMessage hWndControl, %TBM_SETRANGE, %TRUE, MakDwd(1,10)
   SendMessage hWndControl, %TBM_SETPAGESIZE, 0, 1
   SendMessage hWndControl, %TBM_SETLINESIZE, 0, 1
   SendMessage hWndControl, %TBM_SETTICFREQ, 1, 1
   SendMessage hWndControl, %TBM_SETPOS, %TRUE, 5


The above may look familiar because I cut and pasted it directly from the code that FireFly generates for the Form.
Title: Slider Control
Post by: Jonathan Bristow on November 11, 2006, 10:51:33 PM
Fantastic, works fine now. Thanks