Share your advanced PureBasic knowledge/code with the community.
-
RASHAD
- PureBasic Expert
- Posts: 4664
- Joined: Sun Apr 12, 2009 6:27 am
Post
by RASHAD »
Hi
Code: Select all
Procedure IsMouseOver(hWnd)
GetWindowRect_(hWnd,r.RECT)
GetCursorPos_(p.POINT)
Result = PtInRect_(r,p\y << 32 + p\x)
ProcedureReturn Result
EndProcedure
If OpenWindow(0,0,0,320,200,"",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
CalendarGadget(0, 10, 10, 230, 180)
ButtonGadget(1,250,10,60,25,"TEST")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit=1
Case #WM_LBUTTONUP
If IsMouseOver(GadgetID(0)) And GetTickCount_() - oTime < GetDoubleClickTime_()
Debug "Left Button Double Clicked"
Result = GetGadgetState(0)
SetGadgetState(0,Result)
Debug Day(Result)
EndIf
oTime = GetTickCount_()
EndSelect
Until Quit
EndIf
Last edited by
RASHAD on Wed May 22, 2019 2:08 am, edited 1 time in total.
Egypt my love
-
RASHAD
- PureBasic Expert
- Posts: 4664
- Joined: Sun Apr 12, 2009 6:27 am
Post
by RASHAD »
# 2:
Code: Select all
If OpenWindow(0,0,0,320,200,"",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
CalendarGadget(0, 10, 10, 230, 180)
ButtonGadget(1,250,10,60,25,"TEST")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit=1
Case #WM_LBUTTONUP
GetCursorPos_(@p.point)
gadid = WindowFromPoint_(p\y << 32 + p\x)
If gadid = GadgetID(0) And GetTickCount_() - oTime < GetDoubleClickTime_()
Debug "Left Button Double Clicked"
Result = GetGadgetState(0)
SetGadgetState(0,Result)
Debug Day(Result)
EndIf
oTime = GetTickCount_()
EndSelect
Until Quit
EndIf
Egypt my love
-
VB6_to_PBx
- Enthusiast
- Posts: 625
- Joined: Mon May 09, 2011 9:36 am
Post
by VB6_to_PBx »
RASHAD ,
both examples work great ,
thank you !
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
-
RASHAD
- PureBasic Expert
- Posts: 4664
- Joined: Sun Apr 12, 2009 6:27 am
Post
by RASHAD »
@VB6_to_PBx
Thanks so much
# 3:
Code: Select all
If OpenWindow(0,0,0,320,200,"",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CalendarGadget(0, 10, 10, 230, 180)
SetClassLongPtr_(GadgetID(0), #GCL_STYLE, GetClassLongPtr_(GadgetID(0), #GCL_STYLE) !#CS_DBLCLKS)
ButtonGadget(1,250,10,60,25,"TEST")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit=1
Case #WM_LBUTTONDBLCLK
GetCursorPos_(@p.point)
gadid = WindowFromPoint_(p\y << 32 + p\x)
If gadid = GadgetID(0)
Debug "Left Button Double Clicked"
Result = GetGadgetState(0)
SetGadgetState(0,Result)
Debug Day(Result)
EndIf
EndSelect
Until Quit
EndIf
Egypt my love