Form not obeying OpenForm Parameters

I should go back to the tutorial and cover form building, but this seems so basic. …
This file opens one form in an .initialize routine. It looks a lot like:

local newWindowRect
newWindowRect=rectanglecenter(info(“screenrectangle”),
rectanglesize(1,1,250,350))
//rectanglesize(TOP, LEFT, HEIGHT, WIDTH)
setwindowrectangle newWindowRect
openform “ACA Password Entry”, “Title”, “ACA Password Entry”, “NoButtons”, “yes”,
“toolbar”, false(), “Scrollbars”, false(), “noversionbutton”, “yes”,
“shadow”, “no”, “WindowsMenu”, “no”, “noicon”, “yes”

From reading the Help descriptions, though I disable all the controls, I’d still want a form window instead of a dialog window.

The problem is, like the way a 2 or 3-year-old listens to their mother, nothing is done. I still get the database name in the title, the icon, the window menu, etc. And though I change the dimension of the window in rectanglesize(, then Save, close the window, close the database, and reopen, the form stays the size it was before.

So it’s like it sees the OpenForm, but ignores the rest.

I’m not using a dialog window because eventually, I’ll want to open the database, windowless,
pull a value from a field, and close the database. Maybe it doesn’t matter if, when it is opened, the .initialize doesn’t fire and data is just pulled from a record.

As a StandAlone it would be waiting for me to enter two fields of data. But a simple form (with all those features turned off) seems like it would do the job without invoking any of the timing issues (resume, etc.) associated with a dialog.

The OpenForm doesn’t aways ignore those additional parameters. Sometimes they do what is expected.

I strongly urge you NOT to try to open a form window in the .Initialize procedure. Instead, you should use Panorama’s facility for specifying the arrangement and location of windows as a database is opened.

Of course. Because it is already open before you even run the openform statement. So the openform statement does nothing.

There is no way you can disable those items when the database opens. Can’t be done.

Jim, thank you for the direction. I have no vested interest in doing something a certain way, just the end result.

Not showing the database name, icon, etc. were part of the OpenForm options, but from what you said, it seems they would take effect when opening a second form - because if you are not using .initialize to trigger the form (with OpenForm).

My goal is to open a window with just a title bar with the form name. The body of the form that has some labels, some textdisplays, two textEdit fields, and two buttons One of the buttons Saves and closes the database.

I suppose I could create that form and quit the database with that being the only open window. Then it would just open that window on relaunch. But I also want it to be centered on whatever monitor I’m using. That’s why I was using openform - to position it an trim off the extras.

I started down the Initial Windows path.

Though the Form Properties allows me to set the size, I didn’t see a setting for location relative to monitor size; i.e. center screen. So, because the Newly Opened Database Window Arrangement said It could include a PROCEDURE: I figured I could use the same OpenForm code I had in .Initialize - now removed - in a procedure to set the attributes and center the location on the screen.

After the Form Name line in the Initial Windows box, I carriage returned to the next line and entered PROCEDURE:PositionWindow - that’s the name of my procedure where I pasted the OpenForm I took out of .Initialize.

I got this error when I pushed Okay: “arraysearch( function: ARRAY parameter must be text or binary.”

I tried another procedure name just to see if it liked any procedure and got the same error message. So I must be misunderstanding the PROCEDURE: option in the Initial Windows box.

Next I’ll try putting the OpenForm code in the code area of the form.

Note that at the end of that Help topic, it says, "From then on, the form will always open to that exact position and size. English is a funny language. One person’s “exact position” is a certain pixel coordinate. Another person’s “exact position” is the center of the screen - any screen, any orientation. I have one 1920 x 1080 monitor in landscape and one 1200 x 1920 monitor in Portrait orientation. I want the window to open centered on either one; the “exact” center :slightly_smiling_face:

Quick Follow up - Somehow the .Initialize window got renamed to PostionWindow and the original PostionWindow that had the OpenForm statement was renamed to PositionWindow2. I didn’t rename anything. But that PROCEDURE: issue is not a matter of naming because I’m sure by initial trial with PositionWindow was good - as was my trial with another simple procedure name.

Still no luck in getting the form to open with all the parameters activated, like only the form title, no icon, etc. - all those options listed for the OpenForm statement. I was able to paste the open form into the procedure attribute for the form.

This is just a simple file - it’s not important by itself. Being able to open any form I want, with any options available, either as the database starts up or after it is already open, is important.

I’ll keep trying different things - I know I’ve seen this form open without the database name, but maybe the datasheet view was already open at that time - so the form would have been a second window, not the only window.

Panorama has so many customization options that it’s perhaps easy to imagine that it’s infinitely customizable. But of course it isn’t. What you want to do simply isn’t possible in the current version of Panorama X. I’m sorry, but there is no way to have a form window open at a calculated position. It can either open back up to the last position it was open to (the default), or to a fixed position. The Initial Dimensions option only allows you to specify constant numeric values, there is no way to calculate these values.

Jim,
Well that’s okay - I’m an adult, I know I can’t have everything :slightly_smiling_face:
Now that I know that it’s not possible - I’ll stop trying and move on to another phase of my project.

I just figured there was something - besides not knowing it wasn’t possible - I was missing.

I can open it relative to the upper left-hand corner of whatever monitor is being used - so I’ll be sure to be able to see it - it won’t be outside the visible window.

I guess the basic question is when does OpenForm Open a form and obey all the optional parameters?
I switched to creating a form called FirstWindow and made it 10 pixels by 10 pixels opening at 10 pixels by 10 Pixels - sort of the way Jim Cook used to hide his startup window years ago.

In the form procedure event - the insertion bar doesn’t show up when I click the Procedure attribute at the top of the properties with text and code, etc. I put in a procedure call in the procedure event box about mid-properties the procedure opens the form I want with OpenForm.

Now the desired window opens up centered, and just as the title and no icons, etc. But I can still resize it. I thought I had turned that off. Also, behind it - at the same size, not 10 x 10 pixels, is the FirstWindow Blank form.

So I added OpenForm FirstWindow to the procedure to bring the blank window(form) front, then issued a CloseWindow to remove it. But it doesn’t come forward and doesn’t close. However, I can’t make it disappear because when I click on it, I’m guessing clicking on it triggers the procedure that opens the second form, brings the first one forward, and closes it. except it’s still on the screen.

I didn’t see a control to close a specific Form/Window without bringing it forward first. There is no CloseWindow (or CloseForm) with a Form name parameter. The Help just says I have to make the window I want to close active first. Which wouldn’t be bad if, as I put in the Window Properties, it was 10 x 10 pixels. If it followed those specs, or smaller. it would be gone in the blink of an eye. Half a bink.

I don’t think starting with a Secret Window would work - opening the database with no windows and once open, maybe in .initialize call a procedure to open the desired form so it will obey all the optional parameters in its statement.

It just seems like .Initialize is the place you get the house ready for guests - you select and sort to put all the records in an expected starting order, define all the variables you need and give them initial values, then, after the house is clean, you open the front door - with OpenForm and bring the guests (users) into the living room which is decorated just the way you want it (via all the parameters in the openform statement). Maybe, if OpenForm needs not to be the first window. Before the guests enter they can wipe their feet on the door mat - which happens to be a tiny pixel by pixel window at the top corner of the monitor that is there for an instant and then closes after the second, “main” window is open.

But I think I mouse-trapped myself. Because when I use the View menu to open that first blan form, it opens with the title “Null:FirstWindow” and when I click on it, it triggers the procedure that makes the second window active. So how do I get to the properties of the first window to turn that off?

Have you ever seen the movie Fantasia, the Night on Bald Mountain segment where mickey mouse turns the broom into a helper to assist in filling the well? And then realizes he doesn’t know how to turn the broom off - it’s like that.

Interesting. I thought this was a good time to learn to restore from TimeMachine. As fate would have it my hub, with a SSD TimeMachine drive inside, failed to mount the drive, though all the other ports were working. Fiddling with unplugging and firmly plugging it back in brought it back. But It was a few days old.

Not willing to give up, I opened the Pan file, saw the “Remove” lightening bolt when I put the second form into graphics mode, clicked it, taking away that form and making the second form active, then I could put it in graphics mode. Of course once I did that, I saw I hadn’t pasted the instructions to switch to the other window in the form itself, I just called a procedure. Duh - I like to separate those thing; my style - actions go in procedures to be called. So I just had to take that CloseWindow out of the procedure. Still don’t know why the window doesn’t actually close. It passes control to the second form, but the first window is still visible on the screen.

End of saga - no more stories for a while.

Opensecret might be the ticket to do what you want. Note that the .initialize procedure is not run when a file is opened secretly but your original code could be adapted to use opensecret followed by the desired code to open the form in the center of the screen. The following is your code with additions to secretly open your file (I have named it “Passwords” since I don’t know the file name you are actually using) and then to make it active and open your form where you want it placed.

local newWindowRect
newWindowRect=rectanglecenter(info(“screenrectangle”),
rectanglesize(1,1,250,350))
//rectanglesize(TOP, LEFT, HEIGHT, WIDTH)
setwindowrectangle newWindowRect
opensecret "Passwords"
setactivedatabase "Passwords"
openform “ACA Password Entry”, “Title”, “ACA Password Entry”, “NoButtons”, “yes”,
“toolbar”, false(), “Scrollbars”, false(), “noversionbutton”, “yes”,
“shadow”, “no”, “WindowsMenu”, “no”, “noicon”, “yes”

If you need the .Initialze procedure for this file to execute you can run it after the form is opened. I have not checked to see if this works since I do not have a properly registered copy of Panorama X at the moment and it is almost impossible to do anything useful with puzzle dialogs popping up every few minutes.

Yes, that will work if you are opening the database from some other already open database. I think what Paul wants is to simply be able to double click on the database in the Finder to open it. In that case the form is opened by Panorama itself, not by the openform statement, so there’s no opportunity to customize how it opens in that situation.

Ok, how about having the file set to open with no windows and have the .Initialize procedure create a timer that delays a second or two and then calls the procedure that opens the form. Just a thought.

Panorama X does not have an option to open a form with no windows. Panorama 6 had that option, but it was a bit of a tech support problem because people would accidentally set it and then couldn’t get into their database any more. So that option was left out of Panorama X.


… I’m not sure how I feel about what this says about me, but I couldn’t resist this challenge. I have just now implemented a (pretty simple) new way to allow the initial form dimensions to be calculated “on-the-fly” as the form is opened. Not only does this work when the database is opened, but also if you open the form with the View menu.

It will be interesting to see if anyone other than Paul uses this. Then again, I may well use it myself, it’s kind of cool. I’ll provide more details on how this works later.

Jim, I did try an avenue where I created a blank form called FirstWindow. In the DataBase Options, I set FirstWindow up to be the initial window - was supposed to be only 10 x 10 pixels (at location 10, 10) on the screen. In the Form event Procedure of FirstWindow, I called a procedure that used OpenForm - with all the optional parameters - to open my desired window. It did size, position, and title it according to those options - but not all them them. For example, there was still an icon and I could still resize it.

I also tried to put a PROCEDURE: in that Database Options window with the initial FORM: I figured the procedure could open the second window and close the first. But I’d get some “array” error when I tried to use PROCEDURE: there - even when. called some neutral procedure that showed variables.

Because I didn’t see a way to close a specific window (form) that wasn’t active, ofter OpenForm for my desired window, the procedure made FirstWindow active (with a simple openform “FirstWindow”, and then Close Window to get rid of it.

Tha made my desired window active but FirstWindow didn’t close, it was positioned and sized the same as the second window.

Just for the thrill of it, I’m working with two monitors, the default is in landscape and the extension is in Portrait orientation (better for reading magazines and full page documents). Even if I move the file onto the second monitor, it still opens, centered, on the main monitor - which it should.

It’s just that not al the options seem to obey the “yes”/“no” settings and CloseWindow doesn’t close the FirstWindow.

Thank you for putting time on this. We know Panorama knows what the dimensions of the default monitor are, so ya sorta think it could position relative to that - if requested.

This comes into play because you don’t know what monitor a file might be opened on, or where it was positioned when it was closed. So it could be closed in Situation A - like over on a second monitor, and then the file opened on a different computer with a different monitor. If it tries to open were it was last, it will be off in space somewhere.

I see what you mean about users getting in trouble. Because opening the second window was in the FormEvent Procedure of the FirstWindow, every time I tried to put FirstWindw (again- that’s a blank form I was trying) in graphic mode, it would make the other window active. :smiling_face: But that was a feature, not a bug, because I got to learn more about TimeMachine.

This is something I ran across while playing with the above code. I think it might be important to note that the window that is opened that uses the NoButtons option set to “yes” is impossible to close even via a procedure. The window will not show up in the list of open windows in the Window menu, the Close Window menu item in the File menu will be grayed out and Command-W will also have no effect. The window will be shown in a list of windows generated by info(“windows”) and the window dimensions will be shown using Window Dimensions… from the Window menu. At this point you will need to close the database in order to close that window.

Just something to be aware of if you implement it.

And, and … if that’s your initial window, it will open when the database opens. I’d almost expect some FlashAudio feature to announce, “There can be only one.” because it will be immortal.