Skip to main content

How to Programmatically add an empty Event and Invoke the Event Editor for it

In order to create an empty user event in code, use the TcxSchedulerControlEvent‘s overloaded constructor that takes a scheduler’s storage instance as an argument. Using this overload allows you to bind a user event created programmatically to storage.

After the new user event has been created, use the scheduler’s EditEventUsingDialog method to invoke the Event editor, so an end-user can complete scheduling for it.

// ...
var
  AEvent: TcxSchedulerControlEvent;
begin
  AEvent := TcxSchedulerControlEvent.Create(cxSchedulerStorage1);
  try
    AEvent.Caption := 'Created in code';
    // invoke the Event editor for the created event
    cxScheduler1.EditEventUsingDialog(AEvent);
  finally
    FreeAndNil(AEvent);
  end;
end;

The following image shows the result:

See Also