Is there a list of CalendarGadget events?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Is there a list of CalendarGadget events?

Post by Kurzer »

Dear fellows,
did anybody know which events are supported by the CalendarGadget?
The help is not very helpful here.

Thanks in advance.
Markus

Edit:
It seems that only an event is created when the user clicks on a day item. But if the user selects another month or year, no event is created. Unfortunately this is not very practical. How can I react to changing month and year without an event?

Code: Select all

  Procedure EventHandler()
  	Debug "---------------"
  	Debug EventGadget()
  	Debug EventType()
  EndProcedure
  
  OpenWindow(0, 100, 100, 230, 260, "Click test", #PB_Window_SystemMenu)
  CalendarGadget(0, 10, 10, 210, 240)
  BindGadgetEvent(0, @EventHandler())
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Is there a list of CalendarGadget events?

Post by Peter »

Phew, that's not easy! This is the best I can do at the moment:

Code: Select all

EnableExplicit

Procedure CalendarGadgetEvent()
  Protected GID, FocusedDate
  GID = GadgetID(0)
  ! v_focuseddate = dijit.byId(v_gid.gadget).currentFocus
  Debug FocusedDate
EndProcedure

OpenWindow(0, 0, 0, 230, 260, "CalendarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

CalendarGadget(0, 10, 10, 210, 240)

Define GID = GadgetID(0)

! v_gid.gadget._onOldMonthSelect = v_gid.gadget._onMonthSelect;
! v_gid.gadget._onMonthSelect = function(a) {
!   v_gid.gadget._onOldMonthSelect(a);
!   f_calendargadgetevent();
! }    

! $(v_gid.gadget.decrementMonth).click(f_calendargadgetevent);
! $(v_gid.gadget.incrementMonth).click(f_calendargadgetevent);
! $(v_gid.gadget.previousYearLabelNode).click(f_calendargadgetevent);
! $(v_gid.gadget.nextYearLabelNode).click(f_calendargadgetevent);
This code fires events for the areas marked in red:

Image

I would have liked to offer keyboard events as well, but I don't know how that works at the moment.
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Is there a list of CalendarGadget events?

Post by Kurzer »

Peter,
thank you very much for your great effort! Image

Together with the regular BindGadgetEvent() command, the gadget now works as it is needed in practice.

Thanks a lot!

Cheers Markus
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: Is there a list of CalendarGadget events?

Post by Fred »

I guess it should be native, right ?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Is there a list of CalendarGadget events?

Post by Peter »

Fred wrote:I guess it should be native, right ?
8-)
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Is there a list of CalendarGadget events?

Post by Kurzer »

Fred wrote:I guess it should be native, right ?
That would be wonderful, Fred. Image
It would make the gadget more valuable to everyone.

Markus
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
Post Reply