Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using Google Calendars in 4D Live Window
PRODUCT: 4D Web 2.0 Pack | VERSION: 1.1 | PLATFORM: Mac & Win
Published On: August 1, 2007

You can easily view an existing Google Calendar in a 4D Form by using the 4D Live Window plug-in and slightly tweaking the following 4D code. Note that this is a read only view of the calendar, you are not allowed to make or delete events using this simple access method.

The first step is to view your Google Calendar in another web browser, not 4D. Once there, select the Calendar Settings option in the pop-up to the right of the selected calendar. On the web page that shows up select the HTML button for either the Calendar Address or Private Access set of buttons. Either of the buttons will show the basic HTML link that you can use to show your Google Calendar in the 4D Live Window area. The Calendar Address mode means that you must have given public access to the selected calendar, the Private Access means that you give full access to your calendar to whoever has the private-access token (or your code). With either of the HTML buttons you can also select the "configuration tool" link which allows you to customize the look of your calendar with much more detail. The Google Calendar help links have more detailed information on these options.

The following 4D code shows what you need to display your calendar in a 4D Form. Both of these examples use a plug-in area for 4D Live Window named "xLiveWindow". They also need to have the email address and private-access token updated to your particular settings. The required links or HTML code is put into a $html variable so that it can be easily updated with your values.


`define the variable used here


$webError:=Web_SetURL (xLiveWindow;$html)`load the live HTML page into the 4D Live Window area


`define the variables used here

` build the simple HTML page that will be displayed on your 4D Form using 4D Live Window
` the src parameter is the account name ""
` the pvttk is the Google Calendar assigned access number of this calendar
` see the Google Calendar page that created the HTML for more options and explanations

$html:=$html+"<iframe src=\""
$html:=$html+"&amp;title=4D Tech Tip Calendar"
$html:=$html+"&amp;chrome=NAVIGATION" `change the look: ALL, NAVIGATION, NONE
$html:=$html+" style=border-width:0 width=\"800\" frameborder=\"0\" height=\"550\">"

TEXT TO BLOB($html;$htmlBLOB;3) `convert TEXT to BLOB
$webError:=Web_SetContent (xLiveWindow;$htmlBLOB;3) `send the BLOB and display the HTML returned