Jump to content
Nafrayu

Precisely navigating through a huge number range

Recommended Posts

Nafrayu

I kinda need a GUI element that allows the user to precisely choose a number between 500 and 1500, sliders would need to be really huge to be able to do this

Does anyone have an idea, or a solution even?

I don't need decimal precision, selecting between 999 and 1000 should be as easy as going from 500 to 1000 though.

Something like this would be amazing:

https://wiki.garrysmod.com/page/Category:DNumberScratch

Share this post


Link to post
Share on other sites
Zedna

Use 4 radiobuttons + ListBox

RadioButtons will be used for quick switching/filtering of ListBox's range: 500-750 / 750-1000 / 1000 - 1250 / 1250-1500

Or such similar princip of several GUI controls combined together ...

 

Or use 4 Edit boxes (with UpDown) each for 1 cipher of your number:

1500 = 1 + 5 + 0 + 0

Share this post


Link to post
Share on other sites
Bilgus
; combobox
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local Const $sR0 = "1"
    Local Const $sR1 = "1|2|3|4|5"
    Local Const $sR2 = "1|2|3|4|5|6|7|8|9"
    Local Const $sR3 = "1|2|3|4|5|6|7|8|9"
    Local $idComboBox[4]
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 300, 200)

    ; Create a combobox control.
    $idComboBox[0] = GUICtrlCreateCombo("0", 10, 10, 20, 20)
    $idComboBox[1] = GUICtrlCreateCombo("0", 30, 10, 20, 20)
    $idComboBox[2] = GUICtrlCreateCombo("0", 50, 10, 20, 20)
    $idComboBox[3] = GUICtrlCreateCombo("0", 70, 10, 20, 20)
    $idInput1 = GUICtrlCreateInput("0000", 10, 40, 80, 24)
    Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25)

    ; Add additional items to the combobox.
    GUICtrlSetData($idComboBox[0], $sR0)
    GUICtrlSetData($idComboBox[1], $sR1)
    GUICtrlSetData($idComboBox[2], $sR2)
    GUICtrlSetData($idComboBox[3], $sR3)
    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $sComboRead = ""

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idClose
                ExitLoop

            Case $idComboBox[0], $idComboBox[1], $idComboBox[2], $idComboBox[3]
                $sComboRead = GUICtrlRead($idComboBox[0]) * 1000 + GUICtrlRead($idComboBox[1]) * 100 + GUICtrlRead($idComboBox[2]) * 10 + GUICtrlRead($idComboBox[3])
                GUICtrlSetData($idInput1, $sComboRead)

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

I was going to suggest something similar, Unless you make a custom control like the one you linked to there is not much as far as windows controls that will do that

Share this post


Link to post
Share on other sites
Melba23

Nafrayu,

Yet another suggestion:

#include <GUIConstantsEx.au3>
#include <UpDownConstants.au3>
#include <EditConstants.au3>

Global $fLimit = True

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

$cHundreds = GUICtrlCreateInput("5", 10, 10, 60, 30, $ES_RIGHT)
GUICtrlSetFont($cHundreds, 18)
$cUD_Hundreds = GUICtrlCreateUpdown($cHundreds, BitOr($UDS_WRAP, $UDS_ALIGNRIGHT))
GUICtrlSetLimit($cUD_Hundreds, 15, 5)

$cTens = GUICtrlCreateInput("0", 70, 10, 40, 30, $ES_RIGHT)
GUICtrlSetFont($cTens, 18)
$cUD_Tens = GUICtrlCreateUpdown($cTens, $UDS_WRAP + $UDS_ALIGNRIGHT)
GUICtrlSetLimit($cUD_Tens, 9, 0)

$cUnits = GUICtrlCreateInput("0", 110, 10, 40, 30, $ES_RIGHT)
GUICtrlSetFont($cUnits, 18)
$cUD_Units = GUICtrlCreateUpdown($cUnits, $UDS_WRAP + $UDS_ALIGNRIGHT)
GUICtrlSetLimit($cUD_Units, 9, 0)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    ; Allow only 1500 and not higher
    If GUICtrlRead($cHundreds) = 15 Then
        If $fLimit = True Then
            GUICtrlSetData($cTens, "0")
            GUICtrlSetData($cUnits, "0")
            GUICtrlSetLimit($cUD_Tens, 0, 0)
            GUICtrlSetLimit($cUD_Units, 0, 0)
            $fLimit = Not $fLimit
        EndIf
    Else
        If Not $fLimit Then
            GUICtrlSetLimit($cUD_Tens, 9, 0)
            GUICtrlSetLimit($cUD_Units, 9, 0)
            $fLimit = $fLimit
        EndIf
    EndIf
WEnd

Lots of ways to skin this particular cat....

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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

×