Can't use the pause statement within an if structure

It would appear that a procedure with a pause statement within an if block will not compile unless there is also a resume statement within the same block. I want to do this:

if OwnerPIC = ""
    openform "EnterPIC"
    zoomwindow 250,800,200,280,"nopalette noscroll"
    pause
endif 

where the user enters a PIC value in the EnterPIC form which triggers a resume statement. But I can’t.

Is there a good reason why this is the case?

As described on the help page, the pause statement requires a parameter. In Panorama X the parameter isn’t actually used for anything, but it is retained for compatibility with old code. You can just use "" as the parameter. It would also take resume as the parameter, but it would in that case think that resume was a variable name. It could also just as easily take zorgatron as the parameter, or x+y/z. Any legal formula will work.

Here is a revised version of your code that should work. I have also rewritten this code to eliminate the zoomwindow statement, taking advantage of the new features of openform in Panorama X. This eliminates the possibility of the user seeing the window jump around as it opens.

if OwnerPIC = ""
    openform "EnterPIC",
        "rectangle",rectanglesize(250,800,200,280),
        "toolbar",false(),
        "scrollbars",false()
    pause ""
endif

The resume statement would NEVER be in the same block with pause, or even in the same procedure. It needs to be in a separate procedure that is triggered by some user action, usually a button. In Panorama X usually the resume statement is simply embedded into the button code.

Like the pause statement, the resume statement has a vestigial parameter that no longer does anything, but is still required as a placeholder. I usually just use "" for this parameter.

So the real problem was my failure to add the dummy parameter, not the location of the pause statement. Understood.

And thanks for the neat code snippet. I “know” what the openform statement does, so I don’t need to look it up in Help. Trouble is, I don’t “know” enough.

I figure that there are probably lots of people that aren’t cognizant of all of the minor new features in Panorama X, so when I see something an opportunity and I’m not super pressed for time (just “regular” pressed :slight_smile: ), I like to go into a bit more detail not just for the person asking the question, but for everyone here.