Recent

Author Topic: tvPlanit onDelete  (Read 453 times)

Nicole

  • Sr. Member
  • ****
  • Posts: 355
tvPlanit onDelete
« on: August 01, 2022, 09:22:24 am »
I remember to have read here about an onDelete event.
But I cannot find it any more.

I want to perform some action if the user clicks on "delete" an event out of the context menu.
How to?

wp

  • Hero Member
  • *****
  • Posts: 10060
Re: tvPlanit onDelete
« Reply #1 on: August 05, 2022, 01:10:01 pm »
Added an OnDeletingEvent property to TVpDayView and TVpWeekView (but not to TVpMonthView which, so far, does not provide a "DeleteActiveEvent" method). It fires BEFORE the event is deleted and you must return a boolean true to confirm deletion. An "OnDeleteEvent" after deletion seems to be rather useless to me because the event no longer exists.

Nicole

  • Sr. Member
  • ****
  • Posts: 355
Re: tvPlanit onDelete
« Reply #2 on: August 05, 2022, 03:33:59 pm »
My topic is this:
I SYNC data between tvPlanit and a second source. So "add" is fine: The event is triggered, the event data is sent to the other source. And I add it to my sync-source. Modify troubles me a little at the moment, I am not sure, what exactly is done by start edit (is this the name?) and the modify thing. What I need is an interface, which allows me to compare the old values of the event with the new one.

Huge trouble gives me "delete". How can I hinder, that my alternative source grows bigger and bigger and not-actual, because there is no way to find out, when an event from the calendar is deleted?
« Last Edit: August 05, 2022, 03:37:09 pm by Nicole »

wp

  • Hero Member
  • *****
  • Posts: 10060
Re: tvPlanit onDelete
« Reply #3 on: August 05, 2022, 06:59:06 pm »
OK - TvPlanIt is not very well-designed. All these events should be fired by the datastores rather than by the visual controls. But that's the way TurboPower wrote it - I don't have the power to rewrite this library from ground up.

Why isn't the new OnDeletingEvent good for this job? TVpDayView and TVpMonthView have a method DeleteActiveEvent which queries confirmation from the user and then, if allowed, deletes the active event. Without rewriting a lot of code this is the only way an event can be deleted now. OnDeletingEvent is fired from this method as an alternative to the confirmation message. So, when you provide a handler for this event you get the event which will be deleted (provided that your handler returns true for the DoIt parameter), and you can remove the event from your secondary storage.

What I need is an interface, which allows me to compare the old values of the event with the new one.
The RecordID of the event is never changed when an event is edited/modified. So, simply search your secondary storage for the RecordID of the event passed to the OnModifyEvent, and you got it.
« Last Edit: August 05, 2022, 07:02:44 pm by wp »

Nicole

  • Sr. Member
  • ****
  • Posts: 355
[solved] Re: tvPlanit onDelete
« Reply #4 on: August 05, 2022, 07:36:07 pm »
There it is!
Thank you so much.
It needed an update of the component, therefore I did not see it.

With this delete-event I will find a way.
And thank you for the hint of the ID of the event.

And: I messed something else, but for this I make another posting.

 

TinyPortal © 2005-2018