Rework Stack (or Card) Script Using Framework Messages
Now I'm going to rework some of your existing application handlers (preOpenStack and resizeStack) to take advantage of framework messages.
Edit Stack Script
What Is Going On?
The preOpenStack message in Article Maestro does a few things.
1) Displays the registration dialog using Zygodact.
2) Performs some operations that should only happen the first time the stack is opened during a session.
Both of these operations can take advantage of framework messages. The registration process is something tied to the application as a whole, not the main application window. I am going to decouple the registration process from the main window by moving this code to the glxapp_initializeApplication message in the application stack script.
The code should only run once can take advantage of the PreOpenWindow message that the framework sends to managed windows. This message has a parameter specifying whether the window is being opened for the first time during a session. The reason this might be important is that on OS X it is common to be able to close the main application but not quit the application. When the user reopens the main window there is no reason to run the initialization code again.
Edit application Stack Script
I have switched to using the ResizeView handler that the framework sends. resizeStack is sent when the user resizes a stack window. If your program window has multiple cards then you usually only resize the controls on the visible card. ResizeView is sent when navigating to different cards so that you can make sure your interface always matches the current size of the stack window.