Page 1 of 1
CalendarGadget and EventType?
Posted: Sat May 30, 2009 8:00 pm
by Marco2007
Hi,
is there a chance to retrieve the State of a CalendarGadget by LeftDoubleClicking on a date on the CalendarGadget?
Has anyone an idea, please?
Thank you
Marco
Posted: Wed Jun 03, 2009 5:06 pm
by srod
Is this what you are after ?
Code: Select all
#MCN_SELECT = #MCN_FIRST + 4
Global gOldProc, gBlnSelected
Procedure calProc(hWnd, uMsg, wParam, lParam)
Protected result, selDate
Static dateBeforeClick, dateAfterClick
Select uMsg
Case #WM_LBUTTONDBLCLK
result = CallWindowProc_(gOldProc, hWnd, uMsg, wParam, lParam)
If gBlnSelected
selDate = GetGadgetState(0)
Debug "New date selected through double-click : " + FormatDate("%dd/%mm/%yyyy", selDate)
gBlnSelected = #False
EndIf
Default
result = CallWindowProc_(gOldProc, hWnd, uMsg, wParam, lParam)
EndSelect
ProcedureReturn result
EndProcedure
Procedure WinCallback(hwnd, msg, wparam, lparam)
Protected result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*pnmh.NMHDR = lparam
If *pnmh\hwndFrom = GadgetID(0)
Select *pnmh\code
Case #MCN_SELECT
gBlnSelected = #True
EndSelect
EndIf
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 0, 0, 220, 280, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CalendarGadget(0, 10, 10, 200, 180)
SetClassLong_(GadgetID(0), #GCL_STYLE, GetClassLong_(GadgetID(0), #GCL_STYLE)!#CS_DBLCLKS)
gOldProc = SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @calProc())
SetWindowCallback(@WinCallback())
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
Posted: Wed Jun 03, 2009 6:06 pm
by Marco2007
You are a fu**ing genius!!!
Thank you very much!!!!!!!!!
Re: CalendarGadget and EventType?
Posted: Wed Jun 03, 2009 9:38 pm
by PB
What's wrong with GetGadgetState?
Posted: Wed Jun 03, 2009 10:09 pm
by Marco2007
It`s like a DateRequester: The Calendargadget pops up in a seperate window (click on '...'), when using #nxPropertyBox_CustomTextDialog from nxProperty...
I did it with GetGadgetState...but then I have to click first on the date and then close the window by extra-clicking on X. A double-click is much better and usual
I didn`t have a better idea, how to do this.
Posted: Thu Jun 04, 2009 3:55 pm
by Shardik
Fluid Byte already posted a code example in the German forum in September 2008:
http://www.purebasic.fr/german/viewtopi ... 92&start=4
Posted: Thu Jun 04, 2009 4:31 pm
by Marco2007
...and why didn`t you tell me on Sat May 30?
OF course, I´ve searched on the German board, too -> but always "Calendargadget" with the wrong word... I just had to use "klick" instead of "click"...
...so Fluid is also a fu**king genius.

Posted: Thu Jun 04, 2009 4:38 pm
by srod
Fluid's is a much better solution. Use that one!

Posted: Fri Jun 05, 2009 8:38 am
by Shardik
Marco2007 wrote:...and why didn`t you tell me on Sat May 30?

I am a professional programmer who looks into the PB forums only during his working hours (if time allows)
but normally not during weekends...
Marco2007 wrote:OF course, I´ve searched on the German board, too -> but always "Calendargadget" with the wrong word... I just had to use "klick" instead of "click"...

A search with only "calendargadget" in the German forum would have shown Fluid Byte's posting as the 4th entry...
But if the forum search doesn't deliver the wanted results it's always worthwhile to try a Google search with the site parameter:
"calendargadget site:
http://www.purebasic.fr"
(Thank you PB for this hint in a previous thread

)
Using this approach you are also searching through German and French forums and the Google search is more reliable than the forum search.
Posted: Fri Jun 05, 2009 11:44 am
by Marco2007
Shardik wrote:A search with only "calendargadget" in the German forum would have shown Fluid Byte's posting as the 4th entry....
Yeah, I found out yesterday...I thought, searching only for calendargadget will display too many results...
Shardik wrote:
worthwhile to try a Google search with the site parameter:
"calendargadget site:
http://www.purebasic.fr"
Good to know and thanx!
Shardik wrote:...who looks into the PB forums only during his working hours (if time allows)
forum sites are banned, where I work
