# UPDOWN arrow Control with decimals

## Recommended Posts

Hello,

Is it possible with an updown arrow control to increase the number value by a decimal value :

Case 1 : 5.0001 up : 5.0002 / 5.003 and so on, down : 5.0000 / 4.9999 and so on,

Case 2 : 3000.00 up : 3000.01 / 3000.02 and so on and down : 3000.00 / 2999.99 / 2999.98

Case 3 : idem with 1 decimal,

Case 4 : idem with no decimal.

Edited by A. martinod

##### Share on other sites

Hello,

Is it possible with an updown arrow control to increase the number value by a decimal value :

Case 1 : 5.0001 up : 5.0002 / 5.003 and so on, down : 5.0000 / 4.9999 and so on,

Case 2 : 3000.00 up : 3000.01 / 3000.02 and so on and down : 3000.00 / 2999.99 / 2999.98

Case 3 : idem with 1 decimal,

Case 4 : idem with no decimal.

Not directly, but it's easy to do the math and generate the same effect by attaching the UpDown to a separate input control from the value you want:
```#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global \$title, \$input1, \$input2, \$updown, \$iUpDown = 0, \$iCurrent = 5

\$title = "My GUI UpDown"
GUICreate(\$title, -1, -1, -1, -1, \$WS_SIZEBOX)

\$input1 = GUICtrlCreateInput(StringFormat("%#.3f", \$iCurrent), 10, 10, 100, 20); Current value

\$input2 = GUICtrlCreateInput(0, 120, 10, 20, 20); UpDown offset value
\$updown = GUICtrlCreateUpdown(\$input2)

GUISetState()

; Update the current value until the dialog is closed
Do
If \$iUpDown <> 0 Then
\$iCurrent += (\$iUpDown * 0.001)
GUICtrlSetData(\$input1, StringFormat("%#.3f", \$iCurrent))
GUICtrlSetData(\$input2, 0)
EndIf
Until GUIGetMsg() = \$GUI_EVENT_CLOSE

MsgBox(0, "Final value", \$iCurrent)```

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

## Create an account

Register a new account

×

• Wiki

• Back

• Git