Possible to add mouse click to string gadget?
-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
Possible to add mouse click to string gadget?
Is it possible to add a mouse click event to the string gadget?
Last edited by SkyManager on Wed Sep 09, 2015 9:30 am, edited 1 time in total.
Re: Possible to add mouse click to text gadget?
Windows only:
You can also use an imagegadget or a canvasgadget or a disabled button, ... as a textgadget.
Tess.
Code: Select all
If OpenWindow(0,0,0,550,700,"TextGadget",#PB_Window_SystemMenu | #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
TextGadget(0, 10, 10,250,20,"Clic me ",#SS_NOTIFY)
Repeat
event=WaitWindowEvent(10)
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Debug "Surprise"
EndSelect
EndSelect
Until event=#PB_Event_CloseWindow
EndIf
Tess.
-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
Re: Possible to add mouse click to text gadget?
Tess,
Thank you for your quick reply.
Very sorry, I apologize for my mistake,
The correction is :
String gadget
It is just a typing mistake
Thank you for your quick reply.
Very sorry, I apologize for my mistake,
The correction is :
String gadget
It is just a typing mistake
- RSBasic
- Moderator

- Posts: 1228
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: Possible to add mouse click to string gadget?
Code: Select all
EnableExplicit
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(1, 10, 10, 200, 20, "", 0)
Repeat
Select WaitWindowEvent()
Case #WM_LBUTTONDOWN;or #WM_LBUTTONUP
If GetActiveGadget() = 1
Debug "Cick"
EndIf
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIfCode: Select all
EnableExplicit
Global StringProc
Procedure StringProc(hWnd, uMsg, wParam, lParam)
Select uMsg
Case #WM_LBUTTONDOWN;or #WM_LBUTTONUP
Debug "Click"
EndSelect
ProcedureReturn CallWindowProc_(StringProc, hWnd, uMsg, wParam, lParam)
EndProcedure
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(1, 10, 10, 200, 20, "", 0)
StringProc = SetWindowLongPtr_(GadgetID(1), #GWL_WNDPROC, @StringProc())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong


