Page 1 of 1

Is there a list of CalendarGadget events?

Posted: Mon Nov 16, 2020 4:44 pm
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())

Re: Is there a list of CalendarGadget events?

Posted: Mon Nov 16, 2020 7:52 pm
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.

Re: Is there a list of CalendarGadget events?

Posted: Mon Nov 16, 2020 8:24 pm
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

Re: Is there a list of CalendarGadget events?

Posted: Tue Nov 17, 2020 8:49 am
by Fred
I guess it should be native, right ?

Re: Is there a list of CalendarGadget events?

Posted: Tue Nov 17, 2020 8:56 am
by Peter
Fred wrote:I guess it should be native, right ?
8-)

Re: Is there a list of CalendarGadget events?

Posted: Wed Nov 18, 2020 4:28 pm
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