Jump to content

GUICtrlCreateInput. Can no set upper limit higher than 32767


Suppir
 Share

Recommended Posts

I need to create digits-only input with up-down with maximum range from 0 to 999999999999 (12 digits)

My code:

$Input1 = GUICtrlCreateInput("0", 395, 35, 96, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Updown1 = GUICtrlCreateUpdown($Input1)
GUICtrlSetLimit($Input1, 12) 
GUICtrlSetLimit($Updown1, 999999999999, 0)

but maximum value of up-down is restricted to 32767. How to set higher value with up-down?

Edited by Suppir
Link to comment
Share on other sites

GUICtrlSetLimit "limits the number of characters/pixels for a control."

So "GUICtrlSetLimit($Updown1, 4, 1)" does not mean that you can only enter the values 1,2,3,4. It means that you can enter values with a LENGTH between1 and 4 characters.

Please search the forum. There are scripts available that limit the values you can enter.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

GUICtrlSetLimit "limits the number of characters/pixels for a control."

I know it. I set

GUICtrlSetLimit($Input1, 12)

to prevent manual entering more than 12 digits.

And I set

GUICtrlSetLimit($Updown1, 999999999999, 0)

to up-down between zero and 999999999999 (to exlude negative digits)

BUT

up-down is stopping on 32767. And deny go higher. I think, problem is in memory type. Can not solve it.

Edited by Suppir
Link to comment
Share on other sites

I know it. I set

GUICtrlSetLimit($Input1, 12)

to prevent manual entering more than 12 digits.

And I set

GUICtrlSetLimit($Updown1, 999999999999, 0)

to up-down between zero and 999999999999 (to exlude negative digits)

BUT

up-down is stopping on 32767. And deny go higher. I think, problem is in memory type. Can not solve it.

Why not just drop the up/down, it's gonna take days (weeks?) anyway to go from 0 -> 999999999999 :)

whim

Link to comment
Share on other sites

Why not just drop the up/down, it's gonna take days (weeks?) anyway to go from 0 -> 999999999999 :)

whim

You know, this Input is needed to adjust some $variable by -1 or +1.

But $variable can be 8 or 9-digit length.

Example:

$var=23812345

I need to up and down (want to get 23812346, 23812347) this variable in Input.

But up/down does not allow me set values greather than 32767

How to do this?

Edited by Suppir
Link to comment
Share on other sites

It's a limitation of GUICtrlCreateUpdown. Try the following script and you'll see that you can't go beyond 32767.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $title, $input, $updown, $msg

$title = "My GUI UpDown"
GUICreate($title, -1, -1, -1, -1, $WS_SIZEBOX)
$input = GUICtrlCreateInput(32769, 10, 10, 100, 20)
$updown = GUICtrlCreateUpdown($input)
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

Suppir,

Why not write your own up-down? It is not difficult - peek here if you have problems: :)

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("555555555", 10, 10, 200, 20)

$hButton_Up = GUICtrlCreateButton("5", 210, 10, 20, 10)
GUICtrlSetFont(-1, 10, 400, 0, "Webdings") ; "5" = ^, "6" = v
$hButton_Dn = GUICtrlCreateButton("6", 210, 20, 20, 10)
GUICtrlSetFont(-1, 10, 400, 0, "Webdings")

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_Up
            $iTemp = GUICtrlRead($hInput)
            If $iTemp < 999999999999 Then GUICtrlSetData($hInput, $iTemp + 1)
        Case $hButton_Dn
            $iTemp = GUICtrlRead($hInput)
            If $iTemp > 0 Then GUICtrlSetData($hInput, $iTemp - 1)
    EndSwitch

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

And I ask authors of AutoIt to make possible changing this limitation.

The limitation in a native Windows UpDown control does not come from AutoIt. The values for upper and lower limit are packed together into a single LONG type (32-bits). So each is limited to 16-bits, and is signed, so the values range from -32K to +32K.

:)

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

PsaltyDS, yes, it is understood. GUICtrlEdit is also have limits (32 kb of text) - and this is really tiny amount of data. You can not load little txt-file in GUICtrlEdit. But it is possible to change this limit of GUICtrlEdit.

As for up-down control - I just showed an practical example where limit to 32767 is really not enough:

I have item-ID in database, and this item may be from 1 to 9-digits long. And I need up-down this ID in GUI. I think other people may have the same problem.

Link to comment
Share on other sites

  • Moderators

Suppir,

As PSaltyDS told you, it a Windows limitation, so how do you expect the AutoIt Devs to change it? I do not think MS will alter their API just for you. :)

What is wrong with using the user-drawn version I showed you above?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Suppir,

As PSaltyDS told you, it a Windows limitation, so how do you expect the AutoIt Devs to change it? I do not think MS will alter their API just for you. :)

What is wrong with using the user-drawn version I showed you above?

M23

Your version is very nice (I used it in my script).

Link to comment
Share on other sites

  • 1 month later...

For anyone else who may be looking for a solution to this I made a function that allows an input box with an up/down control to contain a value greater than 32767.

Func _GUICtrlUpdownSetRange32($h_updown=0, $i_Low=-999999, $i_High=999999)
    ; Windows message ID for the UDM_SETRANGE32 message
    ; UDM_SETRANGE32 - Sets the 32-bit range of an up-down control.
    ; http://msdn.microsoft.com/en-us/library/bb759968%28VS.85%29.aspx
    Const $UDM_SETRANGE32 = $WM_USER+111
    GUICtrlSendMsg($h_updown, $UDM_SETRANGE32, $i_Low, $i_High)
EndFunc

This sets the range to a default of -999999/999999 but I believe the Low and High values can be any value less than (2^32)-1.

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...