Jump to content

can detect GUICtrlCreateUpDown(-1) ??


 Share

Recommended Posts

can i use case to detect GUICtrlCreateUpDown(-1) if was click up or down button ?

$_wait_input = GUICtrlCreateInput("2000", 730, 40, 74, 20)

$_wait_X = GUICtrlCreateUpDown($_wait_input)

Switch GUIGetMsg()
        Case $_wait_X
            If $_wait_X = True Then
                ConsoleWrite("$_wait_X 1" & @CRLF)
            Else
;~                 If $_wait_X = False Then
                    ConsoleWrite("$_wait_X 2" & @CRLF)
            EndIf

 

or my destiny is input with updown when value its <1 its beacome decimal

mean if u have value 2 and click down u have 1 but if u have 1 and click down it go 0.9 up to 0

if i know how detect up or down was clicked i can try continue or i made 2 buttons looks like updown control ??

Link to comment
Share on other sites

  • Developers

just read the value with:

$ival=GUICtrlRead($_wait_input).

Like shown in the helpfile example.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You can use a quicker approach where you keep previous value and compare with new value.  I personally prefer a more "elegant" solution using WM_NOTIFY.  Following both ways in same example :

#include <GUIConstants.au3>
#include <Constants.au3>
#include <StructureConstants.au3>

Global Const $UDN_DELTAPOS = -722
Global Const $tagNMUPDOWN = $tagNMHDR & ";int iPos;int iDelta"
Global $hUpDown

Example()

Func Example()
  GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX)
  Local $iStart = 2
  Local $idInput = GUICtrlCreateInput($iStart, 10, 10, 100, 20)
  Local $idUpDown = GUICtrlCreateUpdown($idInput)
  $hUpDown = GUICtrlGetHandle($idUpDown)

  GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY)

  GUISetState()

  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        ExitLoop
      Case $idUpDown
        ConsoleWrite(GUICtrlRead($idInput) - $iStart & @CRLF)
        $iStart = GUICtrlRead($idInput)
    EndSwitch
  WEnd
EndFunc   ;==>Example

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
  Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam), $tNMUPDOWN
  If $tNMHDR.hWndFrom = $hUpDown And $tNMHDR.Code = $UDN_DELTAPOS Then
    $tNMUPDOWN = DllStructCreate($tagNMUPDOWN, $lParam)
    ConsoleWrite($tNMUPDOWN.iPos & "/" & $tNMUPDOWN.iDelta & @CRLF)
  EndIf
  Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

 

Link to comment
Share on other sites

  • Moderators

Verssuss,

And just for fun, a dummy updown:

#include <GUIConstantsEx.au3>

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

$cInput = GUICtrlCreateInput(1, 10, 10, 50, 20)

$cDummyInput = GUICtrlCreateInput(10, 75, 10, 1, 20)
$cUpDown = GUICtrlCreateUpdown($cDummyInput)
GUICtrlSetLimit($cUpDown, 19, 0)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cDummyInput
            _SetData()
    EndSwitch

WEnd

Func _SetData()

    Local $iDummy = Number(GUICtrlRead($cDummyInput))
    If $iDummy >= 10 Then
        GUICtrlSetData($cInput, $iDummy - 9)
    Else
        GUICtrlSetData($cInput, "." & $iDummy)
    EndIf

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

3 hours ago, Jos said:

just read the value with:

$ival=GUICtrlRead($_wait_input).

Like shown in the helpfile example.

it just read value of input i want detect if up or down was used

 

$_wait_input = GUICtrlCreateInput("2000", 730, 40, 74, 20)

$_wait_X = GUICtrlCreateUpDown($_wait_input)

    Case $_wait_X
            $iva1=GUICtrlRead($_wait_input)
            $iva2=GUICtrlRead($_wait_X)
            ConsoleWrite("1: " & $ival & "/2: "& $iva2 & @CRLF)

wm_notify need read so many data to do simple thing

thx melba for best suggestion u just missed 0 before . 
here is full what i need

 

#include <GUIConstantsEx.au3>
$hGUI = GUICreate("Test", 500, 500)
$cDummyInput = GUICtrlCreateInput(1, 10, 50, 50, 30)
GUICtrlCreateUpdown(-1)
GUISetState()
Local $max = False
While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cDummyInput
            _SetData()
    EndSwitch

WEnd

Func _SetData()
    If GUICtrlRead($cDummyInput) = 0 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.9")
    EndIf
    If GUICtrlRead($cDummyInput) = -1 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.8")
    EndIf
    If GUICtrlRead($cDummyInput) = -2 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.7")
    EndIf
    If GUICtrlRead($cDummyInput) = -3 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.6")
    EndIf
    If GUICtrlRead($cDummyInput) = -4 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.5")
    EndIf
    If GUICtrlRead($cDummyInput) = -5 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.4")
    EndIf
    If GUICtrlRead($cDummyInput) = -6 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.3")
    EndIf
    If GUICtrlRead($cDummyInput) = -7 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.2")
    EndIf
    If GUICtrlRead($cDummyInput) = -8 and $max = False Then
        GUICtrlSetData($cDummyInput, "0.1")
    EndIf
    If GUICtrlRead($cDummyInput) = -9 and $max = False Then
        $max = True
        GUICtrlSetData($cDummyInput, "0")
    EndIf
    If GUICtrlRead($cDummyInput) > 0 Then
        $max = False
    EndIf
        If GUICtrlRead($cDummyInput) < 0 Then
        GUICtrlSetData($cDummyInput, "0")
    EndIf


EndFunc


now just insert here right For loop
but cant find now

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