SetViewLayOut
Definition
This is a method of the SAPCalendar.Calendar library. It is used to define the appearance of different views in the calendar during runtime.
Use
This method is used to organize the layout of the appointment view with other views of the calendar. This comprises of:
-
Defining the position of the appointment view in the calendar.
-
Defining the size of the appointment view in the calendar.
Structure
The SetViewLayOut method has the following characteristics:
Name
SetViewLayOut
Signature
Public Sub SetViewLayOut(ByVal viewType As CALENDAR_VIEWS, ByVal posType As LAYOUT_POSITION, ByVal widthPerc As Integer, byVal heightPerc As Integer)
Parameters
ByVal ViewType as CALENDAR_VIEWS
ByVal posType as LAYOUT_POSITION
widthPerc as Integer
heightPerc as Integer

The CALENDAR_VIEWS can contain the following enum values:
1 – for only appointment view (Day view, week view or month view)
2 – for only date picker view
6 – for appointment view with interchangeable date picker view (Week view, month detail view or month overview)
10 – for interchangeable appointment view (Day view, week view or month detail view)
The LAYOUT_POSITION can contain the following enum values:
0 – To place the appointment view above the other view.
2 – To place the appointment view below the other view.
8 – To place the appointment view to the right of the other view.
16 – To place the appointment view to the left of the other view.

In the appointment view or date picker view, values assigned to the parameters posType , widthPerc and heightPerc do not affect the appearance of the calendar.
Example
Case 1 : Assume that the calendar view required is an Interchangeable appointment view with:
-
Date picker month view such that the appointment view appears on the right side of the date picker month view.
-
The appointment view occupies 60 % of the total width.

‘Defining enums for the calendar view
Public enum CALENDAR_VIEWS
CALENDAR_VIEW_APPOINTMENTS = 1
CALENDAR_VIEW_DATEPICKER = 2
CALENDAR_VIEW_APPOINTMENTS_DATEPICKER = 6
CALENDAR_VIEW_APPOINTMENTS_DATEPICKER_MONTHS = 10
End enum
‘Defining enums for layout of the appointment view
Public enum LAYOUT_POSITION
POSITION_TOP = 0
POSITION_BOTTOM = 2
POSITION_RIGHT = 8
POSITION_LEFT = 16
End enum
‘Defining the variables
Dim layOutPos as LAYOUT_POSITION
Dim calViewType as CALENDAR_VIEWS
‘ Set the layout and position the AppointmentView on the right side of the DatePickerMonths view
layOutPos = LAYOUT_POSITION.POSITION_RIGHT
‘Set the view to the Interchangeable AppointmentView with DatePickerMonths view
calViewType = CALENDAR_VIEWS.CALENDAR_VIEW_APPOINTMENTS_DATEPICKER_MONTHS
PObjCalendar.SetViewLayout(calViewType,layoutPos,60,100)
This code sets the display as follows:
-
The calendar with the appointment view on the right side of the date picker months view.
-
Appointment view occupies 60 percent of the calendar display area.
Case 2 : Assume that the calendar view required is an appointment view.

‘Defining enums for the calendar view
Public enum CALENDAR_VIEWS
CALENDAR_VIEW_APPOINTMENTS = 1
CALENDAR_VIEW_DATEPICKER = 2
CALENDAR_VIEW_APPOINTMENTS_DATEPICKER = 6
CALENDAR_VIEW_APPOINTMENTS_DATEPICKER_MONTHS = 10
End enum
‘Defining enums for layout of the appointment view
Public enum LAYOUT_POSITION
POSITION_TOP = 0
POSITION_BOTTOM = 2
POSITION_RIGHT = 8
POSITION_LEFT = 16
End enum
‘Defining the variables
Dim layOutPos as LAYOUT_POSITION
Dim calViewType as CALENDAR_VIEWS
‘Set the layout position for the appointment view
layOutPos = LAYOUT_POSITION.POSITION_LEFT
‘Set the view to appointment view
calViewType = CALENDAR_VIEWS.CALENDAR_VIEW_APPOINTMENTS
pObjCalendar.SetViewLayout(calViewType,layoutPos,100,100)
This method will display the appointment view in the calendar.