Back to Devexpress

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

vcl-151006-expressscheduler-how-to-programmatically-add-an-empty-event-and-invoke-the-event-editor-for-it.md

latest1.5 KB
Original Source

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

  • Dec 28, 2020

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.

delphi
// ...
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

TcxSchedulerControlEvent

TcxCustomScheduler.EditEventUsingDialog

TcxSchedulerEvent.Caption