
AGOpen
Why . . .
Why doesn't AGOpen work every time?
"About three quarters of the time I call AGOpen or AGOpenWithSequence,
the guide does not come up. The AppleGuide background process launches,
but help does not come up. If I call it again, help seems to come up
normally."
Two consecutive actions must occur in order to open a guide file:
- The Apple Guide faceless background application must start up, followed by
- Apple Guide getting an event to open the guide file.
The AGOpen... API does both these steps for you with a single call.
Sometimes action (2) occurs before action (1) has completed.
The open event arrives too early, leaving Apple Guide just sitting there
in the background with nothing to do. When you do the second AGOpen,
Apple Guide is already running in the background,
consequently it opens the guide file successfully.
The solution is to do the two actions separately.
The first action is done with an AGStart and then,
when Apple Guide is ready, send the AGOpen or AGOpenWithSequence.
The application must send the AGStart and then wait until Apple Guide is ready.
This can be done in the idle loop. The process goes like this:
- 1. Set a flag to indicate that the guide should be opened.
- 2. In the idle loop (IE every null event):
- If the flag is set:
- Call AGStart once.
- Test to see if AG is ready:
- If AG is ready, do:
- Send AGOpen.
- Unset flag.
- If AG is not ready, continue.
Why does the Apple Guide window flash?
"I call AGOpenWithSequence, but Apple Guide flashes the regular AG topic list before
taking it away and just putting up the sequence."
Here are three possibilities:
kAGDefault
It may be the way you are calling AGOpenWithSequence.
One thing I've found is that you cannot call
AGOpenWithSequence with the "default" guide file,
IE kAGDefault (a nil FSSpec pointer). You must provide a pointer to a valid FSSpec.
If the file spec pointer is nil,
Apple Guide starts up the "default" guide file.
After starting up the guide file, it then does the OpenWith... portion.
This explains the 2-step (IE flashing) window.
Try using a explicit file spec and pass its pointer.
Sequence ID number
And do you have a valid sequence id number?
If you didn't, I would expect Apple Guide to display an error
to the user rather than open the full access window.
Multiple calls
Calling AGOpen followed by AGOpenWithSequence.
The AGOpen would cause the full window to appear then a AGOpenWith...
would replace that with the desired window. Use just AGOpenWithSequence.
© 1997, guideWorks, LLC -- Last updated: 970430 GPB