![]() ![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 150
1998-2004 Gravitybox Software LLC
The first thing that needs to be done is to inform the list box that it needs to be set for
OLE dragging. In its MouseDown event, call its OLEStartDrag method. This will begin a
drag. So that target destination knows what type of drag formats the list box supports,
we set the drag format to the schedule drag format. This is a special constant defined
by the schedule in its OLEDragFormat property. If a target drop destination actually
wants the data, it is set through its OLESetData event. In this event you should set the
data the schedule expects. The only data that the schedule wants is the appointment
length. If you do not set any data the length will be set to the default
ScheduleIncrement. If you have a desired length for the new appointment set it by
creating a byte array using the schedules CreateByteArray method. Send in the
appointment length and an array of bytes that represent this value is returned. This
value is used to populate the Data object. The outline of the appointment as the user is
dragging over the schedule will be this length.
Figure 15.1
The final event used is the schedules AfterAdd event. This will allow us to set the text
displayed inside of the appointment. After the drop the new appointments index in the
ScheduleItems collection is returned as a parameter. You may use this to access the
newly added object and set it DisplayText property. The appointment then will have
been added and the text will have been set.
This is entire application. It will allow you to add appointments by dragging them from an
external object. Keep in mind that the schedules AllowOtherDrops property must be set
to true. This allows you to configure whether the schedule actually allows this type of
appointment adding in the first place.
|