günther
24th July 2009, 14:36
Hi,

although the basic parts had already been discussed, I mananged to figure out one more tricky thing: How to pass an argument to that session, so that the calendar starts with a given date instead of the current date.

Then I decided to build a complete sample; the script can be used *as is*, you only have to create a session and a form with two date fields (date.f, date.t); these must have a zoom session "osstpcalendar".

Here is the script:

declaration:
#include <bic_process>

extern domain tcdate date.f, date.t

field.date.f:
before.zoom:
zoom.to.calendar(date.f)

field.date.t:
before.zoom:
zoom.to.calendar(date.t)

functions:

function zoom.to.calendar(ref domain tcdate date)
{
long child

| Start the calandar with a given date
child = activate("ottstpcalendar", str$(date))

| wait until the calendar is done
wait(child, WTHANG)

| get the return value
date = g.value

| stop the standard program from zooming (it will hang!)
attr.zoomcode = 0
attr.zoomsession$ = ""
}

günther
24th July 2009, 14:40
Oops, the above code contains two errors. It should be zoom.to.calendar(date.f) and zoom.to.calendar(date.t).

Sorry.

Hitesh Shah
24th July 2009, 19:09
Great Work . Keep sharing such nice code.

george7a
4th August 2009, 13:32
Thank you günther for sharing. It is really a nice thing

I have fixed another typo in the function name ;)

saumya
26th November 2009, 07:02
Good Job done.