UpDown Control: How do I determine whick button wa |
Post Reply |
Author | |
Norika
Groupie Joined: 30 November 2006 Status: Offline Points: 70 |
Post Options
Thanks(0)
Posted: 30 August 2011 at 10:43pm |
Hi, I cannot determine which button was clicked of a UpDown control, "Up" button was clicked or "Down" was clicked? I use its Change event becaluse I want to change the value continuously. Please help me!
Best regards
Product: Xtreme SuitePro (ActiveX) version 15.1.2 |
|
Norika
Groupie Joined: 30 November 2006 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Hi, I try a detour path.
Thank you.
Private Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long Private Type POINTAPI
x As Long y As Long End Type Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long Private Declare Function ScreenToClient Lib "user32" _ (ByVal hWnd As Long, lpPoint As POINTAPI) As Long Private P As POINTAPI Private Sub UpDown1_Change()
Dim intPixel_UpDown_ClientTop As Integer
Dim intPixel_UpDown_Height As Integer intPixel_UpDown_ClientTop = Me.UpDown1.Top / Screen.TwipsPerPixelY intPixel_UpDown_Height = Me.UpDown1.Height / Screen.TwipsPerPixelY GetCursorPos P Call ScreenToClient(Me.hWnd, P) If P.y < intPixel_UpDown_ClientTop + intPixel_UpDown_Height / 2 Then
Me.txt_Time.Text = Me.txt_Time.Text + 1 Else Me.txt_Time.Text = Me.txt_Time.Text - 1 End If End Sub
|
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
I think you can use the SyncBuddy property to accomplish your goal:
Will automatically increment/decrement the value in the control by 1 when the up/down button is held down. It will also limit the values to between -100 and 100. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
Norika
Groupie Joined: 30 November 2006 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Dear jpbro, Thank you for your advice. Product: Xtreme SuitePro (ActiveX) version 15.1.2 Language: Visual Basic 6.0 - SP6
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |