Allow negative numbers in edit with updown Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
mynameisjohn
Posts: 32
Joined: 27 Mar 2018, 19:38

Allow negative numbers in edit with updown

18 Jul 2018, 22:19

How can I set UpDown to allow negative numbers to be set inside the Edit without setting a range?

The code below allows a 0-100 range, but when it reaches 0, if I press the down button it won't go lower:
Gui Add, Edit, w50 +0x2001, 1
Gui Add, UpDown, +0x10, 1

Gui Show, w128 h128, Window
Return
Of course if I set a Range-100-100 it will work, but I would like to know if it's possible to allow negative numbers without setting a range, because I never know how many digits the user will input. Maybe it's possible to allow a infinite negative and positive range?
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Allow negative numbers in edit with updown

19 Jul 2018, 02:02

Did you ever try to enter a number like 9999 (which is far away from infinite) using only an UpDown control? It makes no sense.
User avatar
mynameisjohn
Posts: 32
Joined: 27 Mar 2018, 19:38

Re: Allow negative numbers in edit with updown

19 Jul 2018, 02:43

just me wrote:Did you ever try to enter a number like 9999 (which is far away from infinite) using only an UpDown control? It makes no sense.
Steps are adjustable so you can reach big numbers faster:

Code: Select all

VarSetCapacity(UDACCEL, 16, 0)
NumPut(0, UDACCEL, 0, "UInt")
NumPut(1, UDACCEL, 4, "UInt")
NumPut(3, UDACCEL, 8, "UInt")
NumPut(50, UDACCEL, 12, "UInt")

Gui Add, Edit, w50 +0x2001 Range-9999-9999, 0
Gui Add, UpDown, hwndUpDown vUpDown +0x10 Range-9999-9999, 0
SendMessage, 0x0400+107, 2, &UDACCEL, , ahk_id %UpDown%
Gui, Show,, UpDown

Gui Show, w128 h128, Window
Return
So forget about the infinite stuff anyway, I'm just asking if it's possible to allow negative integers without setting a range.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Allow negative numbers in edit with updown  Topic is solved

19 Jul 2018, 05:04

Not if you want the UpDown to update the Edit automatically.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998 and 237 guests