Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomSchedulerStorage.BeginUpdate Method

In This Article

Acquires a lock on the data controller to prevent View update callbacks being made to the registered IcxSchedulerStorageListener listener by the data controller, until a block of data update statements has finished executing.

#Declaration

Delphi
procedure BeginUpdate; virtual;

#Remarks

This method is combined with the EndUpdate method (that releases the lock) to contain a block of update statements. Since the execution of the block of statements can exit with either a normal or exception state, these statements and the EndUpdate method should be contained within try… finally… blocks following the BeginUpdate method to ensure that the lock will be released in all cases.

For clarity a code sample is given below:

Delphi
//...
var
  I: Integer;
  AEvent: TcxSchedulerEvent;
begin
  cxSchedulerStorage.BeginUpdate;
  try
    for I := 0 to 1 do
    begin
      AEvent := cxScheduler.Storage.CreateEvent;
      AEvent.Start := EncodeDateTime(2004, 7, 7, 10, 0, 0, 0);
      AEvent.Duration := Random(100) / 500;
      AEvent.Message := 'Created on start up';
      AEvent.Caption := 'Event # ' + IntToStr(I);
    end;
  finally
    cxSchedulerStorage.EndUpdate;
  end;
end;
See Also