Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slider Control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01275347
Message ID:
01275374
Vues:
31
>>>Perfect! Thanks
>>>
>>>
>>>>>I'm working on a slider control:
>>>>>http://www.geocities.com/kevin.marois/slider/dragdrop1.jpg
>>>>>
>>>>>I can't seem to get the thumb to work right.
>>>>>
>>>>>See this:
>>>>>http://www.geocities.com/kevin.marois/slider/test.zip
>>>>>
>>>>>Anyone know how to go about this?
>>>>
>>>>
>>>>Hi Kevin,
>>>>
>>>>Great Idea !
>>>>
>>>>Just replace the code you have in your MouseMove() event from the CommandButton inside the container with the code below:
>>>>
>>>>
>>>>
LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>>>
>>>>IF nButton <> 1
>>>>	RETURN
>>>>ENDIF
>>>>
>>>>
>>>>IF nXCoord <= This.Parent.Left
>>>>	nXCoord = This.Parent.Left
>>>>ENDIF
>>>>
>>>>IF nXCoord >= This.Parent.Left + This.Parent.Width - This.Width
>>>>	nXCoord = This.Parent.Left + This.Parent.Width - This.Width
>>>>ENDIF
>>>>
>>>>This.Left = nXCoord - This.Parent.Left
>>>>
>>>>RETURN
>>>>
>>>>
>>>>Hope this helps
>>>>
>>>>Cesar
>>
>>
>>Cool !
>>I went further:
>>
>>1 - In INIT() of the CommandButton, add:
>>
>>
This.AddProperty("xOffSet", 0)
>>This.AddProperty("Value", 0)
>>
>>
>>2 - In MOUSEDOWN() event of the CmdButton:
>>
>>
LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>
>>IF nButton = 1
>>	This.xOffSet = (nXCoord - This.Parent.Left) - This.Left
>>ENDIF
>>
>>
>>
>>3 - In MOUSEMOVE() of the CmdButton, add:
>>
>>
LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>
>>IF nButton <> 1
>>	RETURN
>>ENDIF
>>
>>IF nXCoord <= This.Parent.Left + This.xOffSet
>>	nXCoord = This.Parent.Left + This.xOffSet
>>ENDIF
>>
>>IF nXCoord >= This.Parent.Left + This.Parent.Width - This.Width + This.xOffSet
>>	nXCoord = This.Parent.Left + This.Parent.Width - This.Width + This.xOffSet
>>ENDIF
>>
>>This.Left = nXCoord - This.Parent.Left - This.xOffSet
>>
>>This.Value = (This.Left / (This.Parent.Width - This.Width)) * 100
>>
>>WAIT WINDOW TRANSFORM(This.Value, "999.9") + " %" NOWAIT
>>
>>RETURN
>>
>>
>>Note that this way, the position of the button remains correct according to the position of the mouse cursor.
>>
>>Cool, isn't it ?
>
>Yes, I was just looking at that. I noticed that when I pressed the mouse, the button jumped
>a bit. This fixed it.
>
>Thanks!



Great.

Now there are some other things to add:

1 - InteractiveChange event
When the user moves the mouse when left clicking the mouse
2 - Orientation (0 = Horizontal / 1 = Vertical)
3 - Tick Frequency
4 - Tick Style (0 - BottomRight 1 - TopLeft 2 - Both 3 - No Ticks)
5 - Line below the button
6 - SmallChange / Big Change


Very easy stuff...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform