AnyPicker icon indicating copy to clipboard operation
AnyPicker copied to clipboard

How to hook into Set and Cancel functions for the date/time picker?

Open shermmyy opened this issue 9 years ago • 2 comments
trafficstars

I see the "inputSetEvent", which fires every time the date changes.

How do I hook into the Set and Cancel button actions?

shermmyy avatar Oct 06 '16 22:10 shermmyy

Right now there is no separate callback function which is called on button click.

Following 4 callback functions can be used to capture show and hide events of the picker.

  • onBeforeShowPicker - Called before showing AnyPicker View.
  • onShowPicker - Called after showing AnyPicker View.
  • onBeforeHidePicker - Called before hiding AnyPicker View.
  • onHidePicker - Called after hiding AnyPicker View.

I can add that function, but should I add it before or after other code is executed? Do you have any specific requirement? Do you need any specific parameters in buttonClicked.

What I though was to add buttonClicked callback function after other code on that function is executed and function declaration would be buttonClicked(buttonType). Here buttonType can have values - "set", "clear", "cancel" or "now".

nehakadam avatar Oct 11 '16 09:10 nehakadam

Maybe it would be good to have sOutput and oSelectedValues or similar parameters on the onHidePicker too. I'd like to be able to reset the date to it's initial state when user hits "Cancel".

Or maybe it'll be good to have a separate function like resetDate(sOutput, oSelectedValues) or something like that?

Your idea to have a buttonClicked with "set", "clear", "cancel" or "now" sounds good too.

Regards and many thanks for that handy plugin

danielgasser avatar Sep 13 '18 16:09 danielgasser