Page 1 of 1
Posted: Fri Mar 21, 2003 11:07 pm
by BackupUser
Restored from previous forum. Originally posted by effigy.
How would I monitor for a click event on a textgadget. It looks as though by default this does not come in like other gadgets.
Just for some background, the reason I want to do this is because I am trying to build a calendar select routine similar to what Outlook has. I know there is a API calendar that would work, but I just don't like the looks of it.
Thanks in advance.
Derek
Posted: Sat Mar 22, 2003 12:07 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
This Gadget is a static Gadget, this means, it can receive no events.
You can use a WindowCallback Procedure (see SetWindowCallback() ) to monitor the #WM_LBUTTONDOWN Message and then check with WindowMouseX()/WindowMouseY() where the click was.
Timo
Posted: Sat Mar 22, 2003 2:36 pm
by BackupUser
Restored from previous forum. Originally posted by Justin.
It's easier, you only have to add the SS_NOTIFY style. only for windows.
Code: Select all
;Purebasic Window Editor v2.91
;GADGET IDs
#Text0=0
#Button1=1
;WINDOW ID
#Window1=0
#SS_NOTIFY=256
;WINDOW
OpenWindow(#Window1,203,142,409,158,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered,"Window1")
CreateGadgetList(WindowID(#Window1))
TextGadget(#Text0,10,16,90,24,"Click me",#SS_NOTIFY)
ButtonGadget(#Button1,300,112,90,24,"Cancel")
;EVENT LOOP
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_EventGadget
Select EventGadgetID()
Case #Button1
exit=1
Case #Text0
messagerequester("","Click",0)
EndSelect
EndSelect
Until EventID=#PB_EventCloseWindow or exit
Posted: Sat Mar 22, 2003 4:30 pm
by BackupUser
Restored from previous forum. Originally posted by effigy.
Thanks for the answer!
I guess this must be an undocumented feature, I couldn't find any
reference to it in the help file.
You have just made my life easier, thanks again.
Derek
PB Newbie
Posted: Sat Mar 22, 2003 4:54 pm
by BackupUser
Restored from previous forum. Originally posted by Justin.
Yes, it's an API flag, some pb commands support them. you need to know a little of windows programming to use them.