GoForm weirdness

I’m running into this as I work with files I brought over from Pan 6. Pressing a button that executes a procedure that opens another database (usually already open) and makes sure the correct form is showing.

OpenFile "Equipment"
GoForm "EquipList"

Quite often this gets me this error: “GoForm only works with windows that already contain a form”

That’s a reasonable message if there was no form open on the target database, but in fact the exact form I am specifying is already open, and I can even see it behind the database window that has the button. Now I could easily (and have done so) change the command to OpenForm and it seems to work consistently, but I have GoForm commands in dozens of places and I’d like to not have to find and replace them all if there is a way to make GoForm work the way the docs say it will. I wonder if GoForm (in X) is expecting the target database to be the frontmost window, which it never would be if I’m calling it from a form on a different database.

All of these problem commands are in procedures that have worked without complaint in Pan 6 and many versions before.

If the datasheet is the active or foremost window of the targeted database, I believe you’ll get that message.

It seems to matter which window was foremost when the file was last saved. OpenFile brings that window to the front, and if that window isn’t a form window, GoForm isn’t going to work.

You both seem to have missed this part. No datasheet is involved. The database I’m trying to work with has a form open and visible on the screen, but behind the active window.

There is a strange phenomenon going on here though; if I have my procedure window open (not in debug mode) I see the highlight on the GoForm line (see code above) and the error text that I quoted at the bottom of the procedure window. Strangely enough, at this point the command just before it (OpenFile “Equipment”) doesn’t appear to have executed because that file remains behind the file that is running the procedure. It acts like it is running in “anticipation mode” (if there is such a thing), trying to execute a command before a required action is taken, which in fact is right there before this line. To help complicate things, what I’m describing does not happen every time; there are days when it sails along, and other days when I can’t get past it. That is the lot of the beta tester, I suppose.:unamused:

To what degree does the GoForm command obey different rules than it did in Pan 6? This code worked flawlessly, every time, in Pan 6 and before.

I don’t think either one of us missed that point. The point we were making is that OpenFile is bringing something other than a form window to the front, and GoForm is then trying to execute with that window as the active window.

You didn’t say that the form window was the only open window in the target database. You just said that it was open, and behind the active window. We don’t know what else is open.

No datasheet for that database open at all. I just about never have a datasheet open unless there is something specific I need to do at that level, then I close it again. I had a couple of procedure windows open for that database, are they going to be involved that way? I closed the procedures and tried again just now, and it worked correctly, but I’m not sure that proves anything. In the meantime Pan hung and I had to force quit, so the environment changed somewhat. In any case, when it is not working right, nothing on the screen changes before the error comes up - no other window comes to the front.

Possibly you’re barking up the wrong tree then and GoForm is not the issue. If OpenFile isn’t activating the database there’s probably another issue all together. Is the “Equipment” database actially named “Equipment” and not "Equipment " (space on the end) or “equipment” (lowercase)?

Yes. If a procedure window is the frontmost window, goform will not work.

The “frontmost” window is the form in database A that has the button that I am pushing to try to bring up database B’s form. Nothing else is “frontmost”; but would the line OpenFile “Database B” cause one of its procedure windows to hop to the front, instead of its already open form, destroying the whole “GoForm” intent? Is this different behavior than Pan 6? I don’t recall ever having to manage this so carefully. Unfortunately, during development I might have all sorts of procedure windows open at any time.

To avoid further confusion, I should change every instance of GoForm to OpenForm, but that may cause unwanted new windows when I just wanted to change which form is in the current window. I’m not even sure what “current” means any more.

Standard blues riff
I went to the doctor
The doctor said to me
Hey, staylor246, I’m gonna say 1, 2, 3

One, you push the button
Two, you look around,
Three, the thing it starts to growl, then
The whole damn thing comes crashing down.

I got the blues,
I got the blues,
I got the Panorama window management blues, oh yeah.

Play the blues!