Jump to content

Float Spinners in auto it?


carlosa
 Share

Recommended Posts

How many decimal points do you want to go to? You might just want to use two updowns, one for the left side of the decimal, and one for the right.

yeah i thought about that, i was just wondering if there was i way to do it with just one.

would be nice to have that.

cheers,

Los.

Carlos AnguianoSenior Technical Director/Pipeline EngineerRed magnet Studios Venice, CAhttp://www.redmagnetfx.com

Link to comment
Share on other sites

yeah i thought about that, i was just wondering if there was i way to do it with just one.

would be nice to have that.

cheers,

Los.

Since I had no idea what the heck a "Float Spinner" was, I had to try it... :P

The problem I ran into is that although the UP/Down control gets a different control ID than the input to which it is attached, you get the same event message for either the up or down button. :)

All I could come up with was simulating the control with your own buttons:

#include <GuiConstants.au3>

Global $InData = 0
Global $Increment = 1
; Create GUI
Opt("GuiOnEventMode", 1)
$hGUI = GUICreate("Decimal Up/Down", 300, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "_GuiClose", $hGUI)

GUICtrlCreateLabel("Input Data", 20, 20, 153, 20, $SS_CENTER)
$Input = GUICtrlCreateInput($InData, 20, 45, 153, 25)
$InputUp = GUICtrlCreateButton("+", 175, 42, 15, 15)
GUICtrlSetOnEvent($InputUp, "_InputUp")
$InputDown = GUICtrlCreateButton("-", 175, 59, 15, 15)
GUICtrlSetOnEvent($InputDown, "_InputDown")

GUICtrlCreateLabel("Increment", 210, 20, 70, 20, $SS_CENTER)
$IncBox = GUICtrlCreateInput("+/- " & $Increment, 210, 45, 53, 25)
$IncUp = GUICtrlCreateButton("+", 265, 42, 15, 15)
GUICtrlSetOnEvent($IncUp, "_IncUp")
$IncDown = GUICtrlCreateButton("-", 265, 59, 15, 15)
GUICtrlSetOnEvent($IncDown, "_IncDown")

GUISetState()

; Main Loop
While 1
    Sleep(100)
WEnd


Func _GuiClose()
    Exit
EndFunc   ;==>_GuiClose

Func _InputUp()
    $InData = GUICtrlRead($Input) + $Increment
    GUICtrlSetData($Input, $InData)
EndFunc   ;==>_InputUp

Func _InputDown()
    $InData = GUICtrlRead($Input) - $Increment
    GUICtrlSetData($Input, $InData)
EndFunc   ;==>_InputDown

Func _IncUp()
    $Increment = $Increment * 10
    GUICtrlSetData($IncBox, "+/- " & $Increment)
EndFunc   ;==>_IncUp

Func _IncDown()
    $Increment = $Increment / 10
    GUICtrlSetData($IncBox, "+/- " & $Increment)
EndFunc   ;==>_IncDown

Kinda' ugly, but maybe it's a start.

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

that's not a bad idea, but it's to much trouble for what i'm trying to do.

seems to me the problem is with the input style.

if you use the numbers only input style, it dosn't let you type a decimal.

maybe if this style suported float numbers, then the up and down could increment to a float.

unless i'm missing something and there is input style that will allow you to limit the input to float values.

oh yeah what i ment by float spinner is, a numerical input with up and down control, that deals with numbers with deciamals such as 1.5 and not just with integers (non decimal numbers)

cheers,

Los.

Edited by carlosa

Carlos AnguianoSenior Technical Director/Pipeline EngineerRed magnet Studios Venice, CAhttp://www.redmagnetfx.com

Link to comment
Share on other sites

that's not a bad idea, but it's to much trouble for what i'm trying to do.

seems to me the problem is with the input style.

if you use the numbers only input style, it dosn't let you type a decimal.

maybe if this style suported float numbers, then the up and down could increment to a float.

unless i'm missing something and there is input style that will allow you to limit the input to float values.

oh yeah what i ment by float spinner is, a numerical input with up and down control, that deals with numbers with deciamals such as 1.5 and not just with integers (non decimal numbers)

cheers,

Los.

It would at least require an additional parameter to work, since you'd have to specify HOW MUCH to increment/decrement by, which is handled by a seperate set of controls and the $Increment variable in my demo script. I think that would be a usefull style/parameter to add, especially if you could dynamicly change the value after the control was created. I think I'll post that to the idea lab and see if it's been done or rejected for good reason before...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...