Skip to main content

Grouping User Events

  • 3 minutes to read

This topic describes how the grouping of user events is organized in the scheduler control.

To facilitate end-users in the task of time management the scheduler control provides the ability to combine user events in groups in different ways:

  • Default grouping (the scheduler’s OptionsView.GroupingKind property is set to gkDefault) – the user events are grouped by resources and sorted by dates, if more than one resource is defined. Otherwise, the user events are sorted by dates;

  • No grouping (the scheduler’s OptionsView.GroupingKind property is set to gkNone) – the user events are sorted by dates;

  • Grouping by dates (the scheduler’s OptionsView.GroupingKind property is set to gkByDate) – the user events are grouped by dates and sorted by resources;

Note: in the Week, Weeks, or TimeGrid View, when grouping by dates, the resources are sorted vertically in the scheduling area. In this case, the resource headers’ captions are displayed vertically if the scheduler’s OptionsView.RotateResourceCaptions property is set to True, as shown in the image below:

  • Grouping by resources (the scheduler’s OptionsView.GroupingKind property is set to gkByResource) – the user events are grouped by resources and sorted by dates.

Use the scheduler’s OptionsView.GroupingKind property or the View’s GroupingKind property to switch between the grouping types.

To help end-users navigate multiple resources there is a resource navigator in the scheduling area. Using the resource navigator end-users can scroll resources one at a time or by page, jump to the first or last resource, change the number of resources visible in the scheduling area. To change the number of resources in the scheduling area programmatically use the scheduler’s OptionsView.ResourcesPerPage property. Use the scheduler’s ResourceNavigator.Visibility and ResourceNavigator.ShowButtons properties to switch the resource navigator’s visibility. To switch the visibility of individual buttons in the resource navigator, use their Visible property.

Note

to show the resource navigator in the above images under different grouping modes the scheduler’s ResourceNavigator.Visibility property was set to snvAlways.

There is an example available that shows how to set up resources that will be used as common elements to group user events by resources:

Using the Object Inspector, invoke the collection editor, create two resources, name them and set the TcxSchedulerStorageResourceItem.ResourceID property to 1 and 2 for the first and second resource respectively, as shown in the image below:

Using the Object Inspector, set the scheduler’s OptionsView.GroupingKind property to gkByResource. Now run the application and schedule a couple of user events. The result should be similar to the following image:

To change the order of resources an end-user can call the Resources layout editor dialog and select the Resources layout editor… item in the pop-up menu. To invoke the Resources layout editor dialog programmatically, use the cxShowResourcesLayoutEditor procedure.

If the user events are scheduled at a time when no grouping was used or no resources were defined, they do not belong to any resources. To display these user events, when grouping by dates or by resources and if more than one resource is defined, set the scheduler’s OptionsView.ShowEventsWithoutResource property to True. In this case, user events that are not bound to any resource will be shown under every resource that is currently visible in the scheduling area. Any changes made to this kind of user event in any resource automatically affect the replicates in other resources. If when coding there is a need to check whether the given user event is associated with a specified resource use the event’s IsResourceEvent method.

See Also