[Gui UpDown control] - How to know if button up or down was pressed? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User
Posts: 407
Joined: 26 Jun 2017, 08:12

[Gui UpDown control] - How to know if button up or down was pressed?

31 Aug 2018, 21:14

Already tried A_GuiControl, a_guievent, A_EventInfo! They only show "Normal" and "0"!

Code: Select all

Gui, Add, UpDown, gButton, 5

gui, show, w200 h200
return


Button:	;______________ get ______________

msgbox, % A_GuiControl " - " a_guievent " - " A_EventInfo

return

guiclose:	;__________ guiclose __________
exitapp
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Re: [Gui UpDown control] - How to know if button up or down was pressed?

01 Sep 2018, 12:53

The GUI UpDown control attaches itself to the preceding buddy control (commonly Edit). This sample script returns what you want:

Code: Select all

Test := 5
Gui, Add, Edit,
Gui, Add, UpDown,  vValue gButton,5
gui, show, w200 h200
return

Button:	;______________ get ______________
  Gui, Submit, NoHide
  Diff := Value - Test
  Test := Value
  If Diff > 0
    MsgBox It went up!
  If Diff < 0
    MsgBox It went down!

return
My demonstration EggTimer.ahk script makes use of the UpDown GUI control.
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: [Gui UpDown control] - How to know if button up or down was pressed?  Topic is solved

01 Sep 2018, 21:04

jackdunning wrote:.
Thanks for your code, but I was expecting something like the code below:
UpDown Custom Control.png
(3.44 KiB) Downloaded 135 times

Code: Select all

gui, add, ddl, +HwndDDLId, A|B|C|D|E||F|G|H
gui, add, button, x+5 h11 w20 gUpDown, ▴
gui, add, button, y+0 h11 w20 gUpDown, ▾

gui, show
return

UpDown:		;_________________ UpDown ____________________

	;"==" is always case-sensitive

if (a_guicontrol == "▴")
ControlSend , , {Up}, % "ahk_id" DDLId 

if (a_guicontrol == "▾")
ControlSend , , {Down}, % "ahk_id" DDLId 

return

guiclose:	;_________________ gui close _________________
exitapp
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Gui UpDown control] - How to know if button up or down was pressed?

02 Sep 2018, 06:17

Code: Select all

#NoEnv
Gui, Margin, 20, 20
Gui, Add, DDL, w200 vList +HwndDDLId, A|B|C|D|E||F|G|H
Gui, Add, UpDown,  Range1-8 vValue gUpDown, 5
Gui, Show, , UpDown Test

UpDown:		;_________________ UpDown ____________________
GuiControl, +AltSubmit, List ; if not specified above as a DDL option
GuiControlGet, List
GuiControl, -AltSubmit, List
If (Value <> List)
   Control, Choose, %Value%, , ahk_id %DDLId%
Return

GuiClose:	;_________________ Gui close _________________
ExitApp
:?:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Google [Bot], iamMG and 165 guests