I need to filter the data for the calendar section based on a public variable. I cannot find a similar “Where Condition” attribute for the calendar section?
Is there a variable or attribute that stores the current month and year displayed in calendar section
When you specify a “Click delegate” for the calendar section in the attributes, when the user clicks on an event or clicks on a calendar cell the click delegate is called with a JSON encoded string as an argument.
In your case, as you are building a desktop App you can use json_decode() to decode the argument into an object.
This object then has members:
You can look at the object using json_decode( arg )
Example desktop calendar click delegate:
proc myCalendarClickDelegate( arg )
I notice under the calendar options the following attributes
a) Click Delegate
b) Dynamic day backcolor
c) Dynamic event backcolor
d) Dynamic event forecolor
In my case, my table has a field that indicate the type of shift and I want to color the days in a month based on the shift type
As the calendar is being rendered, for each record the “delegate” functions for the dynamic coloring are called. When they are called the active record is in the currently selected cursor.
You can therefore just inspect the fields in the record (or lookup some other data in another table) and return a color code. This color code is a string and can be any of the standard web colors e.g. “pink”, “lightgreen” etc or it can be a HTML/CSS style color code e.g. “#cfcfcf”.
The delegate settings are in the attributes. See below.
If you read the source code of calendar_view.rsp in the library directory you will see how this is achieved.
Also notice in the screenshot that “Event Type choices” determine what appears in the drop down list and also the color that corresponds to that type of event.