Restored from previous forum. Originally posted by ricardo.
What is the easier or better way to detect a mousedown in a gadget?
I want to detect whenever the user do a mouse down inside any gadget.
Thanks
Best Regards
Ricardo
Dont cry for me Argentina...
detecting mousedown in a gadget?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Ofcourse i know how to get a MouseDown event, but i want to know in which gadget does the user do the mouse down, maybe there is some easier way to get it.
ATM im receiving MouseDown event and then using the Mouse-X & Mouse-Y i get if it was inside some gadget but maybe there is another way to do it.
Best Regards
Ricardo
Dont cry for me Argentina...
Ofcourse i know how to get a MouseDown event, but i want to know in which gadget does the user do the mouse down, maybe there is some easier way to get it.
ATM im receiving MouseDown event and then using the Mouse-X & Mouse-Y i get if it was inside some gadget but maybe there is another way to do it.
Best Regards
Ricardo
Dont cry for me Argentina...
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
, otherwise i could use the click, but the idea is that the user will mantain pressed the button and then i need to know which gadget are pressed before release it.
Best Regards
Ricardo
Dont cry for me Argentina...
But i need to know it when the user are still pressing the button, before releasing itOriginally posted by Danilo
Use EventGadgetID() to get the Gadget
where the message comes from.
Best Regards
Ricardo
Dont cry for me Argentina...
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> i need to know it when the user are still pressing the button,
> before releasing it
Do you mean something like this? Note that this example doesn't take
into account if the user has swapped the left/right mouse buttons...
(Fred: The SetGadgetText command in the docs don't say that it can be
used with ButtonGadgets, which may confuse newbies).
PB - Registered PureBasic Coder
> i need to know it when the user are still pressing the button,
> before releasing it
Do you mean something like this? Note that this example doesn't take
into account if the user has swapped the left/right mouse buttons...
Code: Select all
If OpenWindow(0,100,150,450,200,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
bg=ButtonGadget(1,20,20,100,25,"Up")
Repeat
ev=WaitWindowEvent() : GetCursorPos_(mouse.POINT)
If ev=#WM_LBUTTONDOWN And WindowFromPoint_(mouse\x,mouse\y)=bg
SetGadgetText(1,"Down")
While GetAsyncKeyState_(#VK_LBUTTON)0 : Sleep_(1) : Wend
SetGadgetText(1,"Up")
EndIf
Until ev=#PB_EventCloseWindow
EndIf
used with ButtonGadgets, which may confuse newbies).
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm