Click here to Skip to main content
12,078,259 members (45,885 online)
Click here to Skip to main content
Add your own
alternative version

Stats

32.3K views
402 downloads
11 bookmarked
Posted

GLUI-style Spinner

, 20 Jun 2005
Rate this:
Please Sign up or sign in to vote.
Creating an OpenGL GLUI-style spinner.

Sample Image - spinner.jpg

Introduction

Having had loads of fun working with OpenGL, I decided to try my hand at DirectX. I thought what better way to start than to take my OpenGL projects and see how they work in DirectX. I ran into a barrier when the original project used various GLUI objects which are not available in .NET. This is my first GLUI-style control.

Using the code

As this is a beginner control, there is not much difference between this and a Microsoft control. The control is derived from a System.Windows.Forms.Panel as I needed something to contain the System.Windows.Forms.TextBox and two System.Windows.Forms.Button objects. This has allowed me to keep the usability of a single control (i.e., you cannot tab to each button, instead to each spinner as a while).

Each Spinner has the following properties for setting the behavior to the user's liking:

  • The 'Minimum' and 'Maximum' properties to set the range of the Spinner.
  • A 'Value' property to set the original value of the Spinner.
  • A 'Theta' property to set the step value for the Spinner.

Using this control should be as simple as using any other Panel; just drop it on a form and set the listed properties to your desire.

Points of Interest

This is not exactly a final release. I am still relatively new to .NET development, so there are a few features I plan to add just as soon as I learn how. As it stands, you can change the Spinner value in three ways:

  1. Input the value by using the numeric keypad found on your keyboard.
  2. Use the buttons on the right side of the control.
  3. Use the Up and Down arrow keys on your keyboard while the control has focus.

Currently, there is no code in place to stop the user from inputting a value outside the range, but the next click of the button or press of the arrow keys will set the value to the range minimum or maximum, whichever applies.

History

As this is the first draft, there aren't any updates.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

bowlermonk
Web Developer
United States United States
I graduated from Michigan Technological University in 2002 with a bachelor's in Computer Science. I am currently working as a .NET developer.

You may also be interested in...

Comments and Discussions

 
GeneralOut-of-range values Pin
fwsouthern20-Jun-05 17:13
memberfwsouthern20-Jun-05 17:13 
GeneralRe: Out-of-range values Pin
bowlermonk21-Jun-05 3:37
memberbowlermonk21-Jun-05 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160212.1 | Last Updated 20 Jun 2005
Article Copyright 2005 by bowlermonk
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid