I’'m having another problem in conversion from Pan6 to PanX. A message comes up briefly when the file OrdInvPost Template is opened, saying “Initialize Error (OrdInvPost Template). ObjectAction statement can only be used in a form window.”
There are SuperObjects set up in the .CurrentRecord procedure which is called by the .Initialize procedure, so I tried to research PanoramaX Help, but found only one entry for superobjects - info(“activesuperobjects”), which gives no info on how the handle super objects in PanX.
The superobject statement has been renamed in Panorama X, it is now called the objectaction statement. That’s where you’ll find the help for this:
The word superobject will still work, however, you can use either superobject or objectaction.
This is a definite no-no. Please read all the caveats about using the .CurrentRecord procedure. You should definitely NOT put an objectaction statement in the .CurrentRecord code, this falls under the “not ever change the current window or display a dialog or alert” restriction.
Also, as you have discovered, .CurrentRecord may be triggered when a data sheet window is current, or even no window at all (if the windows are all secret). So you definitely cannot send commands to form objects in this procedure.
You could theoretically check to make sure that the correct form was active, and only use the objectaction statement in that case. However, I don’t recommend using objectaction at all in this context. Sending a command to a form object each time the current record changes is not a feature that is supported in Panorama.
You could certainly put an objectaction (or superobject) statement in the code that is triggered when a form is opened. See Form Event Procedures on this help page.