Navigation bar
  Home Print document Start Previous page
 47 of 234 
Next page End  

Gravitybox Schedule Primer
Page 45 
1998-2004 Gravitybox Software LLC
Schedule1.ScheduleItems(3).MaxLength = 120
This code will set the third element in the ScheduleItems collection, so that it may not be
smaller than 30 minutes and no larger than 2 hours.
There are two of events raised as a consequence of
resizing an appointment. The first is the BeforeItemResize
event. This event has as its parameters the appointment’s
index in the ScheduleItems collection and a Boolean Cancel parameter. Once an
appointment is resized the AfterItemResize event is raised with the appointment’s index
as a parameter.
When the user is dragging an edge of an appointment, the WhileItemResize event will
be raised repeatedly. As the user drags an appointment edge, it may be resized many
times before he releases the mouse button. Each resize triggers this event.
AllowOtherDrops
A special Add may be performed if required. A drag of some external object to a
schedule may be desired. This could be a file, picture, etc. Although these items are not
appointments, they might have some significance in your application. In this case, the
schedule property AllowOtherDrops will allow dropping of non-GbSchedule items on the
schedule. This will be performed as follows. The DragDropScheduleItem event will be
raised when the drop has taken place. The BeforeAdd and AfterAdd events will then be
raised, providing an opportunity to do any verification and also to cancel the Add if
necessary. Afterwards the BeforeEdit and AfterEdit events will be raised, in response to
the editing with the default property box.
This action actually takes a bit of work. The source control must be setup as OLEDrag
enabled. This may be accomplished by using three events of the source control. For
example, assume there is a form that has a Listbox and a Schedule on it and the user
should be able to drag a list item from the Listbox and drop it on the Schedule. This may
be accomplished by using the source’s MouseDown event to initiate a drag as follows.
Private Sub List1_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
  Call List1.OLEDrag
End Sub
This action will start the drag; however nothing will happen until there is code in other
events as well. The schedule expects a particular type of drag, so this needs to be
defined in the source’s OLEStartDrag event.
Quick Tip
Cancel a user resize in the
“BeforeItemResize” event.
http://www.purepage.com