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

How to Determine the Time Interval Selected by an End-User

To implement this task, handle a scheduler’s OnSelectionChanged event. The event fires every time an end-user selects a time block in the scheduling area.

Within the event handler, use the scheduler’s SelFinish and SelStart properties to determine the selected interval’s bounds.

In the example, the currently selected interval is displayed in the TMemo edit control embedded into the scheduler’s control box.

Delphi
// ...
procedure TForm1.cxScheduler1SelectionChanged(Sender: TObject);
var
  ASelStart, ASelFinish: TDateTime;
begin
  with TcxScheduler(Sender) do
  begin
    ASelStart := SelStart;
    ASelFinish := SelFinish;
  end;
  with Memo1.Lines do
  begin
    if Capacity > 0 then
      Clear;
    Add('Selected time interval:');
    Add(#13);
    Add(DateTimeToStr(ASelStart));
    Add(DateTimeToStr(ASelFinish));
  end;
end;

The following image shows the code execution result:

See Also