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:
01275733
Vues:
34
>>>>>>>>>>>>>>>>>>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
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>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.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>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
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Hi Kevin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Thanks for the files.
>>>>>>>>>>>>>>I started coding it, but got so excited, and could not stop :-)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>I went a lot further. Please download my version:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>http://weblogs.foxite.com/files/cesarchalom/slidebarx/SlideBarX.zip
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Here are the main changes:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>- Allow the mouse to slide in horizontal and vertical
>>>>>>>>>>>>>>- Added the Value property
>>>>>>>>>>>>>>- Added the "Scrolled" event, to make it compatible with the ActiveX from CTL32 (This will eliminate "ValueChanged")
>>>>>>>>>>>>>>- Recreated the Track images, making it much taller / wider, in order to keep the appearance when the control is big.
>>>>>>>>>>>>>>- Value assignments. Now you can assign a value directly to the control, and the slidebar will automatically update its position.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>- Some other various minor tweaks.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>There are still some things missing:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>1 - to code the horizontal lines
>>>>>>>>>>>>>>2 - To enable "Small Change / BigChange"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Please run the sample again, it was completely updated :-)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Hope you like
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Cesar
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>Very nice. I'll do the horizontal lines now.
>>>>>>>>>>>>>
>>>>>>>>>>>>>As far as the Small/Big change, I have already added a property called iIncrementStyle, where
>>>>>>>>>>>>>0 means that the thumb is automatically aligned to the nearest tickmark, and 1 means that the
>>>>>>>>>>>>>thumb can be moved anywhere.
>>>>>>>>>>>>>
>>>>>>>>>>>>>I'm also going to put code in the MouseEnter and MouseLeave to change the color of
>>>>>>>>>>>>>the thumb, and finally I am also going to add a focus rectangle.
>>>>>>>>>>>>>
>>>>>>>>>>>>>I'll have it all done today and send it back.
>>>>>>>>>>>>>
>>>>>>>>>>>>>Thanks. Nice work.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>Cool !
>>>>>>>>>>>>
>>>>>>>>>>>>I'll wait for your next version till I restart working on it.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>I noticed that you added a Value property, with Access and Assign methods. I'm guessing
>>>>>>>>>>>that you didn't see the property iValue with it's Assign method. Are you ok with me replacing
>>>>>>>>>>>the code in iValue_Assign with what you have in Value_Assign?
>>>>>>>>>>>
>>>>>>>>>>>The reason is that I have been using Hungarian notation for the properties (iValue instead of Value),
>>>>>>>>>>>and I wanted to keep them the same.
>>>>>>>>>>>
>>>>>>>>>>>Sound Ok?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Yes, I noticed that.
>>>>>>>>>>
>>>>>>>>>>Well, it's your control.
>>>>>>>>>>
>>>>>>>>>>I replaced the iValue for "Value" just to make it compatible with the CTL32 ActiveX.
>>>>>>>>>>
>>>>>>>>>>Also, I removed the event "ValueChanged", and replaced it with "Scrolled" that is the name that the CTL32 Control uses.
>>>>>>>>>>
>>>>>>>>>>They all do the same thing...
>>>>>>>>>>Choose the way you prefer.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Another point to think:
>>>>>>>>>>The way aI coded, Value / iValue can be range only between 0 and 100. Maybe the best is to allow the user to define the ranges, and the control will automatically update itself.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Ok, changes are here: http://www.geocities.com/kevin.marois/slider/xslider.zip
>>>>>>>>>
>>>>>>>>>I added the lines when the control is horizontal, and I added the focus rectangle. The rectangle
>>>>>>>>>is be controlable via the ShowFocus property. This property does not prevent the control from
>>>>>>>>>getting the focus, it only determines if the rectangle is visible when the control has the focus.
>>>>>>>>>See the demo form.
>>>>>>>>>
>>>>>>>>>I decide to keep the naming convention as you had it, so that it's compatible with the CTL32
>>>>>>>>>controls. I have renamed all the properties to remove the Hungarian notation.
>>>>>>>>>
>>>>>>>>>I think all that's left is the MaxRange property and the IncrementStyle (Small/Big change).
>>>>>>>>>Want to take it from here?
>>>>>>>>
>>>>>>>>I just fixed a couple of bugs. Please redownload the ZIP
>>>>>>>
>>>>>>>
>>>>>>>Ok,
>>>>>>>
>>>>>>>I feel we're getting close now :-)
>>>>>>>
>>>>>>>I'll code the Small/large change events, and also allow users to define the ranges of the control.
>>>>>>>
>>>>>>>
>>>>>>>Apart from this, we still have:
>>>>>>>
>>>>>>>- Eliminate "InteractiveChange" event, it was replaced with "Scroll"
>>>>>>>- Tick Style (0 - BottomRight 1 - TopLeft 2 - Both 3 - No Ticks)
>>>>>>>- Change the button color when receiving focus
>>>>>>>- Add new styles, to use the images that you sent with the control
>>>>>>>- When receiving focus, allow arrow keys to change the control value
>>>>>>>- Add an image to show the control appearance.
>>>>>>>
>>>>>>>- Allow dynamic modification when users change properties values during development, using Craig Boyd's technique.
>>>>>>
>>>>>>Good. I like it.
>>>>>>
>>>>>>Have you seen the latest ZIP? I updated the Demo form. I think it covers some of the items
>>>>>>in this list.
>>>>>
>>>>>
>>>>>Very nice sample !
>>>>
>>>>Thanks. As far as the Tick Style (0 - BottomRight 1 - TopLeft 2 - Both 3 - No Ticks),
>>>>Right now I have 2 properties, LineStyle (On/off) and LinePosition (0, 1, 2).
>>>>
>>>>When you're done, I'll combine them both into one TickStyle property. I will also work on the
>>>>ThumbColor, remove the InteractiveChange, and also work on the Arrow Keys and MouseWheel.
>>>>
>>>>Thanks for all your help so far. This is coming out nice.
>>>
>>>
>>>I see you gave up sleeping tonight :-)
>>>
>>>Another point I'd like your opinion:
>>>When the user clicks on the control the first time, I think that the correct would be just to set the focus to the control / button, not changing the control value in the first moment.
>>>
>>>After having focus, the next time it gets clicked, changes will be applied.
>>>
>>>What do you think ?
>>
>>Either way is ok with me. Take a look at the Windows Volumn Control dialog. There are both horizontal
>>and verticle sliders on it. When you click on a slider, it receives the focus AND moves the thumb.
>>But like I said, either way is ok with me.
>
>Thanks, I'll check the ActiveX behavior before doing it. Anyway, a property can handle this too. I'll make the default the same as the CTL32 does, ok ?

Sounds good.

Paste this into MouseWheel of the control. Tell me what you think:
LPARAMETERS nDirection, nShift, nXCoord, nYCoord

LOCAL iNewValue AS Integer

WITH This

	IF nDirection > 0
	
		iNewValue = .Value - 1
		IF iNewValue < 0
			iNewValue = 0
		ENDIF
	
	ELSE

		iNewValue = .Value + 1
		IF iNewValue > .MaxRange
			iNewValue = .MaxRange && Assumes "MaxRange" is the prop name
		ENDIF

	ENDIF

	.Value = iNewValue

ENDWITH

RETURN
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