![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 46
1998-2004 Gravitybox Software LLC
Private Sub List1_OLEStartDrag(Data As DataObject,
AllowedEffects As Long)
Call Data.SetData(, Schedule1.OLEDragFormat)
AllowedEffects = vbDropEffectCopy
End Sub
The OLEStartDrag event is called by the Schedule to test whether this source object is
dragging a valid type. The format may be set to the Schedules OLEDragFormat
property.
Private Sub List1_OLESetData(Data As DataObject, DataFormat As
Integer)
This will create a 90 minute appointment
Call Data.SetData(Schedule1.CreateByteArray(90),
Schedule1.OLEDragFormat)
End Sub
The source controls OLESetData event is called by the Schedule when dragging or a
drop has occurred. In this event, the drag format is set to the Schedules
OLEDragFormat property. Also the Schedule expects an appointment length for this
format. The data must be a byte array. So that every developer will not need to create
his own byte array creation routine, one is implemented by the Schedule itself. The
CreateByteArray method takes a string value and returns a byte array with its ASCII
codes. If this is sent into the Data objects SetData method, the schedule will draw an
appointment of this length on itself. If the data entered is invalid or not a number, the
ScheduleIncrement property is used to determine the length of the appointment.
This is not the only way to use the AllowOtherDrops property. When true, any drop will
be valid. The user could drop files from Windows Explorer if he chose to do so. The only
difference is that all of this code would not have been needed and the appointment
would be set to the ScheduleIncrement property. Using the defined technique, allows
the developer to have control over the size of the appointment to be created.
Default Property Window
You may choose to use the default property window
included in the control. If the other properties like AllowAdd
and AllowEdit permit, the default property window will be
displayed when the user adds or double-clicks and appointment. You may cancel this
functionality in the BeforeAdd or BeforeEdit events by setting the Cancel parameter to
false. The AllowAddDialog property also plays a part. Assuming that the property
settings of the control permit, the user will see the default property window. The window
Quick Tip
You may use the default property
window instead of building your own
custom edit screen.
|