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:
01275385
Vues:
29
>>>>>>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 jYust 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...
>>
>>Yes, I already have some of this in there. I just couldn't get the movement right. As soon as its
>>done, I'll send you a copy.
>
>
>Thanks.
>I was thinking of starting developing this control. If you need help, just call me



Ok, I'd love some help. Here's the project
http://www.geocities.com/kevin.marois/slider/xslider.zip

Run the form Demo to see where I'm at.

I was about to code the _SetValue and _PositionThumb methods.

So far, _SetValue is called from the MouseDown of the control
_PositionThumb is called from iValue_Assign.

Those 2 should be fairly simple. If you could work on those and and send it
back, I'll pick it up from there in the morning

I welcome and and all suggestions.

Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform