Recent

Author Topic: tvPlanit - deleting one / many events  (Read 1183 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1002
tvPlanit - deleting one / many events
« on: March 05, 2024, 06:29:02 pm »
In a loop of mine is this line:

Code: Pascal  [Select][+][-]
  1.         res.Schedule.DeleteEvent(event);

This works fine, but not for too many events.
Before deleting I have the events listed, in the previous case, 238 of them.
When I click at delete, then "list" again, they become drastically less each click.
But only 3 or 4 clicks on "delete" removes them completely.

My question:
Does the delete event work in blocks?
And is there a way to make them "delete them all"?



wp

  • Hero Member
  • *****
  • Posts: 12296
Re: tvPlanit - deleting one / many events
« Reply #1 on: March 07, 2024, 06:49:22 pm »
It's hard to guess what might be wrong behind these descripting lines...

I put together a small tvplanit demo containing a list of events marked for deletion. For this purpose, the DayView popup menu has been extended by a "Mark for deletion" item. A click on this adds the currently selected event to the listbox at the right (the event itself is stored in the objects of the listbox.Items). After all events to be deleted are marked, a click on the button below "Delete all selected events" iterates over all events in the listbox, extracts each event from the Listbox.Items.Objects[index] and sets the event's Deleted property to true (and deletes the item from the listbox). After all listbox items have been handled, Datastore.PostEvents is called to transfer the "events to be deleted" (those marked with event.Deleted = true) to the datastore.

If this demo does not describe your issue, modify it so that I see it.

Nicole

  • Hero Member
  • *****
  • Posts: 1002
Re: tvPlanit - deleting one / many events
« Reply #2 on: March 07, 2024, 08:15:43 pm »
Thank you so very much.
In my Lazarus backup folder there is a sub-folder with all those great demos, you posted here.


 

TinyPortal © 2005-2018