Maps a coordinate point to a schedule time.
Syntax
Time = Send_Message(Ctrl, "OLE.MapClientToTime", Coordinate, RoundToNearestInterval)
Parameters
Parameter | Description |
---|---|
Coordinate | The coordinate value to be mapped |
RoundToNearestInterval | Determines whether the result is rounded to the nearest interval |
Returns
The schedule time beneath the given coordinate.
Remarks
The MapClientToTime method maps a given coordinate to the time that would appear beneath that coordiante. This method assumes the given coordinate is relative to the top left corner of the SRP Schedule Control, not the top left corner of the screen or parent form. The coordinate you pass and the result differs depending on the current View.
View = "SingleDay"
In this case, you pass the Y coordinate. The result will be a Time (as opposed to a DateTime) in internal format.
View = "SingleDayHorz"
When using this view, pass the X coordinate. The result will be a Time as well.
View = MultiDayHorz"
As with the other horizontal view, pass the X coordinate. However, since this view has multiple days in one view, the result is in internal DateTime format.
The mouse coordinates you get from various mouse events can be passed to this method as is.
The RoundToNearestInterval parameter is a flag that determines the nature of the result. When you pass 0, then you get the exact time beneath the coordinate. If you pass 1, then you get the time at the interval nearest the coordinate.
Example
// Based on the current view, determine the time beneath the mouse CurrentView = Get_Property(@Window:".OLE_SCHEDULE", "OLE.View") Begin Case Case CurrentView EQ "SingleDay" // Pass Y, result is Time format TimeVal = Send_Message(Ctrl, "OLE.MapClientToTime", Y, 0) Time = OConv(TimeVal, "MTH") Case CurrentView EQ "SingleDayHorz" // Pass X, result is Time format TimeVal = Send_Message(Ctrl, "OLE.MapClientToTime", X, 0) Time = OConv(TimeVal, "MTH") Case CurrentView EQ "MultiDayHorz" // Pass X, result is DateTime format TimeVal = Send_Message(Ctrl, "OLE.MapClientToTime", X, 0) Time = OConv(TimeVal, "DT2/^H'") End Case