Page 1 of 1

Multiple Open Calendars

PostPosted: Sun Sep 26, 2010 1:29 pm
by ScottJ
I'm not sure if I have everything set up correctly. When I go to the calendar from my app it opens in a new window. When running Jump To Event in My Layout the calendar stays open which I like. From my app, if the user hits my Calendar button instead of selecting the existing open calendar, a 2nd Calendar is created. How can I setup that up better.


Thanks
Scott

PostPosted: Mon Sep 27, 2010 5:45 am
by John Sindelar
Hi Scott,

In your file, the script a use runs to open the calendar should do something like this:

Set Error Capture [ On ]
Select Window [ the name of the calendar window, which is probably the name of the file, be sure you uncheck the box constraining this selection to windows of the currrent file ]
If [ Get ( LastError ) = 0 ] // ie the window was there and is now selected
Exist Script
Else
Do whatever you were doing to open the calendar
End If

Hope that helps,

John

PostPosted: Mon Sep 27, 2010 8:08 am
by ScottJ
The script it running the exit script line even when the calendar is not open. It is using the name of the file, "Peak7"

In my startup script "Upon Opening" is on the first line. A few lines down I have

Set Window Title[Current WIndow;New Title: Get (FileName)]
#---------Required by Seed Code Calendar

Is there a chance that my other windows are called "Peak7". I'm sure how to figure that out.

Thanks
Scott

PostPosted: Wed Sep 29, 2010 12:32 am
by ScottJ
I changed the name of my main window since the calendar uses the filename also.

Close to the beginning of the Load Calendar Layout it checks for multiple windows. The code there is

#So we do't run this on spawning new windows
if[ValueCount(WIndowNames(get(filename))>1)
Exit Scrip[]

It exits there so does not load data for the calendar. Perhaps I could skip that section but would like to know if that is what would be recommended. Obviously it is there for a reason.

Thanks
Scott

PostPosted: Wed Oct 20, 2010 3:55 pm
by ScottJ
John,
You had said that the easiest way to open the calendar in a new windows is by having the calendar as a separate app. I have all ready integrated the calendar into my app and would like to keep it in the app at this point. Here is where I am having trouble

Close to the beginning of the Load Calendar Layout it checks for multiple windows. The code there is

#So we do't run this on spawning new windows
if[ValueCount(WIndowNames(get(filename))>1)
Exit Scrip[]

PostPosted: Thu Oct 21, 2010 8:03 am
by John Sindelar
You've already integrated it: got it. Thanks.

If you're always having two windows up, you could change the following to us a 2 instead of a 1:

If[ValueCount(WIndowNames(get(filename))>1)
Exit Scrip[]

If that doesn't help, unfortunately I have to confess that I've kind of lost the thread of what behavior we're trying to change. Can you let me know what the problem is and I'll try to help.

- John