Fired when the user finishes dragging a new appointment.

Parameters

ParameterDescription
EntityIDID of the appointment's parent entity
StartDateTimeThe new start date & time
EndDateTimeThe new end date & time
ApptToCopyThe appointment to copy, if any
ShiftSet to 1 if a shift key was held during the drag operation
CtrlSet to 1 if a control key was held during the drag operation
AltSet to 1 if an ALT key was held during the drag operation

Remarks

The AfterNewApptDrop event is fired when the user releases the mouse button at the end of dragging a new appointment. The EntityID parameter is the unique ID of the entity to which the new appointment should be added. The StartDateTime and EndDateTime parameters contain the new appointment's intended start and end times respectfully. Both parameters are in OI's internal DT format.

The control does not add the new appointment for you. You are responsible for adding the new appointment using the AddAppts method. The reason for this is that appointments require unique keys and cannot generate these automatically.

The user also has the option of double clicking to create a default sized appointment. Doing so will result in the same events being fired, so you only have to handle this event once.

Copying Appointments

The final parameter, ApptToCopy, will have a value if the user is attempting to create a new appointment by CTRL+Dragging an existing one. In this case, ApptToCopy will be set to the key of the appointment the user dragged. You are still responsible for adding the appointment copy. Do this by first reading the source appointment's Appt property. Update the start and end times, give it a new key, and call AddAppts.

Example

Transfer Param1 to EntityID
Transfer Param2 to StartDateTime
Transfer Param3 to EndDateTime
Transfer Param4 to ApptToCopy
Transfer Param5 to Shift
Transfer Param6 to Ctrl
Transfer Param7 to Alt

If ApptToCopy EQ "" then
   // New appointment
   NewAppt = EntityID:@VM:GetNextApptID():@VM:StartDateTime:@VM:EndDateTime:@VM:RGB(127, 0, 0):@VM:RGB(255, 255, 255):@VM:"New Appt":@VM:"This is a new appt."
end else
   // Copy an appointment
   NewAppt = Get_Property(@Window:".OLE_SCHEDULE", "OLE.Appt[":ApptToCopy:"]")
   NewAppt<1> = EntityID
   NewAppt<2> = StartDateTime
   NewAppt<3> = EndDateTime
   NewAppt = Insert(GetNextApptID(), 2, 0, 0)  ;// We need a new key in position 2
   Convert @FM to @VM in NewAppt
end

// Add it
rv = Send_Message(@Window:".OLE_SCHEDULE", "OLE.AddAppts", NewAppt)

See Also

BeforeNewApptDragCancelNewApptDragBeforeNewApptDrop

  • No labels