Jump to content

Recommended Posts

Posted (edited)

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.

Thanks for your help,

Edited by A. martinod
Posted

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.

Thanks for your help,

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
    $iUpDown = Number(GUICtrlRead($input2))
    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)

:P

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 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
  • Recently Browsing   0 members

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