Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use spinner? 3

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
585
PH
Hi all... still trying to enhance my application, i have seen some of the sample application done in vfp9 has a spinner? What is the use of spinner? how to use it? Can you please give a simple code and if its not too much to ask with explanation? Thanks and God bless...
 
Hi Mandy,
The spinner control allows users to select numeric values by clicking up or down arrows. You can set the range and the increment in the control.
There are properties in the control to set the high and low values (and these can be done by either keyboard input or "spinner input". These are found in the DATA tab of the control.
Like any other control, give it a name and then you can reference it's value through properties like: MySpinner.Value
That value can be used then as input to other items.

For instance, I use this control on one of my apps for scanning business cards. Some cards have VERY light color inks, so if they don't OCR right I have the option to change the contrast and brightness values of the scan, so that those colors show up better. I change their increment by 50 (with a range of 0 to 1000). That is then fed to variables in the call to my scanning routine (which is a library that I use).

Anything numeric can be made a spinner, and used for that input.

Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
Mandy, I'm sure you will have seen spinners in many Windows applications - even if yo don't recognise the term. For a quick example in VFP, go to Tools / Options / View. In the resulting dialogue, you will see two examples, for "Most recently used list" and "List display count". Just experiment with those examples to see how they work (you won't cause any damage anywhere if you do so).

Personally,I don't much like using spinners. I find it easier simply to type a number. But some users will feel differently.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike/Mandy,
Mike makes a good point, I'm the same way, BUT... the spinner class allows that too. It's an editable text box if you just put the cursor in the box, and type the range. It still validates the range so if my limit is set to 1000 and I enter 3000 it will provide the response message of "Invalid Data". Not real clear, but it does let the user know if they've entered a number out of range. Of course you could implement your own user message in the LostFocus() event (or VALID() event if you wanted something more clear like:
MESSAGEBOX("The value you've entered is <too high, or too low), please reenter") for example.

So the spinner has the advantage of using different inputs, and might be more user friendly on a touch screen application, but power users might like to tab through fields and enter specific values. But the spinner does provide both choices.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
Hello Mandy,

I just want to point out the most important properties you will use when you use a spinner:

SpinnerHighValue and SpinnerLowValue determine the range of allowed values. And as Scott pointed out the user can also key in value. Notice the spinner also has a secondary set of range limits, the KeyboardHighValue and KeyBoardLowValue. So they could even differ. Then you also have the Increment. That defaults to 1 so using the up and down arrows on the right side of the spinner you increase or decrease the value by 1, but that can be a higher change, which is obviously useful for larger ranges of allowed values.

You also have some events specific to the spinner control UpClick and DownClick. In them, you could for example also change the Increment after each value change of the spinner. It could be convenient to lower the increment when the value comes closer to the upper or lower range limits and increase it when you're nearer to the middle of the range.

I have to say I didn't make much use of it, but as Scott said its use case might be Windows tablet users that can easier change a value with the up/down buttons than by tapping into the textbox portion and using the touch keyboard to enter a value. You also could use a slider (ActiveX) control with a min max range and a user can slide to the value they want. This would only take up more area on a form for the convenience of more precision of the slider position and thus the value.


Chriss
 
Thank you all for answering my question on spinner... It made me think twice wether to use or not... Thank you Scott, Mike and Chriss.... as ive said my application is working completely now... this is all because of you all.... just trying to give some enhancements....
 
Mandy,
Any time. There are many creative usages of objects in VFP that are often overlooked. The spinner in the right instances for specific user interface can be a great tool.
You should see what I do with a simple picture object applied to maps. :)


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top