Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remembering Maximixed Windows in VFP 9

Status
Not open for further replies.

proAmateur

Programmer
Jul 29, 2010
11
US
This is a small problem, but a nagging one I haven't found any reference to. I'm using VFP 9 in Windows 7 (both 32 and 64 bit varieties). VFP will remember the size of a previously opened window (of a program or a form) and provide that when I re-open the window, but if I last used a window Maximized, if I later re-open the window, VFP will give me the last Non-maximized window size. It never opens Maximized --I'll have to do that manually. If I could get my maximized windows back, I'd be so happy!

Thanks for any input from anyone on this.
 
There are a couple of things you can do to solve this problem:

1. In the desktop or Start menu shortcut that you use to launch VFP, right-click and choose Properties. In the Run field, set the value to "Maximized". Or:

2. If you have a start-up program, put this command in it:

_SCREEN.WindowState = 2

One or other of those should do the trick.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hi Mike,

Thanks for those suggestions. Launching VFP with properties set to Maximize (nice trick, I didn't know we could do that) didn't work, unfortunately. I tried opening, maximizing, closing, and re-opening a program, and it still wouldn't open maximized.

I've never used a start up program, so I don't know how that works. I did try entering _SCREEN.WindowState = 2 in the Command Window and then opened, maximzed, closed ,and re-opened a program, and it still reverted to the last normal window size.

This is very odd --especially now since it doesn't seem to be common. When I downloaded SP2 I hoped that would fix it, but no luck there. And I've installed VFP at least 4 times on 3 different machines --and all with the same problem.

But I appreciate the help. If you can think of anything else, I'll certainly try it.

Dennis
(First VFP, then VFP+activeX, then VFP to html, then VFP to mySql+PHP+javascript)
 
Dennis,

I don't know why it didn't work when you set the Run field to Maximized. That's not a Visual Foxpro feature - it's built into Windows.

Are you sure you were launching from the same shortcut whose properties you changed? (Sorry if that sounds obvious.)

Re the startup program. This is an ordinary PRG file that you place in the VFP home directory (or any other suitable location). To use it, launch VFP, go to Tools / Options / File Locations, and edit the Startup Program field to point to the file in question. Remember to click Set As Default.

From now on, when you launch VFP, it will run the startup program, and execute whatever commands you placed it in. Many developers use it to launch a custom menu with their choice of developer tools, for example. I use it to display the VFP version number in the title bar.

One other thing to check is that your resource file (FOXUSER.*) is not corrupted (or read-only). Try searching for all FOXUSER.* files and deleting them. These are the files where the session settings are stored. If VFP can't find it, it will create a new one, after which it should store your window sizes etc. for use next time.

Hope this helps. I know how irritating these little things can be.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike, Dennis - I think you're talking about two different things. Mike's talking about maximizing the main VFP window. Dennis is talking about maximizing other windows inside VFP.

That said, I don't know any way to get windows inside to remember being maximized. Never been a problem for me because I never want anything maximized.

Tamar
 
Dennis,

Tamar is right. I was assuming you were talking about the main VFP window.

If you are referring to the state of the individual windows (= forms) in your application, that's an entirely different matter.

VFP makes no attempt to remember the sizes or states of your forms. You have to do that yourself. One way would be to have a table that stores that information. Each time you close a form, save its state in the table. Each time you open it, check the table; if the state is saved, apply it in the form's Init.

In fact, I do exactly that in all my apps. It's not at all difficult and the users appreciate it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Tamar, Mike --

Thank you both very much for your help on this. But I am Sure (almost beyond a reasonable doubt) that it wasn't until VFP 9 that this "problem" began. Perhaps neither of you maximized your windows inside of VFP before and so never missed the loss! Maybe it was a bug that was finally fixed! Anyway, VFP does remember the size of normal windows, so I make my windows as big as possible and kind of grumpily accept that. But thanks again for chiming in.

And Tamar, I never had the opportunity to thank you very much for your excellent Hacker's Guide (ver. 6 for me). That book saved me countless hours of programming time, and was like having a friendly knowledgeable person around when I couldn't decipher MS's often cryptic help. I still have my dog-eared copy. So thanks for that.

Dennis
(First VFP, then VFP+activeX, then VFP to html, then VFP to mySql+PHP+javascript)
 
Dennis,

It's still not clear what windows you are referring to.

These "windows inside VFP" that you are talking about ... Do you mean the forms that you create in your application? If so, then I can assure you that VFP does not have any way of remembering their size, position or window state (normal / max / min) between sessions. You either have to set these factors programmatically when you launch the form, or rely on the design-time settings.

But perhaps you mean the windows within the VFP development environment, like the command window and Browse windows? If so, then their size, etc. are held in the Foxuser tables that I talked about earlier. If it is these windows that are not being restored, then it is a Foxuser issue. It's not a VFP bug, and no behaviour changes since earlier version.

Perhaps you could clarify which windows you are interested it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike - I'm pretty sure Dennis is talking about windows in the IDE, and I did go test before I responded the other day. While FoxUser retains the size of non-maximized windows, it doesn't seem to retain their maximized state.

OTOH, I just tested in VFP 8 and I see the same behavior there.

Tamar
 
Tamar, Mike ---

I need a few days, but I'm going to install VFP7 on another machine and make a real time screen recording of me opening a program window (test.prg), maximizing it, closing it, and then re-opening it (Pre-maximized for my convenience, courtesy of VFP-!). I'll then so the same with my current VFP9 installation and show how it won't do this. Tamar --I never used VFP8 --so I don't know about that.

Dennis
(First VFP, then VFP+activeX, then VFP to html, then VFP to mySql+PHP+javascript)
 
Dennis,

You just said:

... make a real time screen recording of me opening a program window (test.prg)...

(Emphasis added.)

Now that we know you are talking about "program" windows (which I take to mean code editing windows), I can tell you that VFP won't remember the window state.

I know that because I once spent hours trying to get it to do just that - I think I even posted a message here to ask for advice - but without success.

Since then, I've got into the habit if hiting CTRL+F10 each time I open an editing window.

So don't bother with the screen recording.

I must say that you would have saved us all some time if you had made it clear you were talking about editing windows several messages ago, when I asked you to clarify that point.

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike,

For me "program", is synonymous with ".prg". So, when I said in my first post, "previously opened window (of a program or a form)", I just thought everyone would know I meant .prg or .scx. I didn't consider that the more accruate terminology would be "code editing window", so I apologize for the confusion. I didn't respond any further because I thought Tamar had interceded and cleared it up.

But about the screen recording, my intent is to show that VFP7 --unlike VFP9 that I now use-- does indeed remember the maximized state. At least it did in Windows XP. And if it does it in Ver7, why not 9? Maybe it's because I'm using Windows 7 now. But if I could show you a video where VFP7 behaves as I'm saying it does, would that be of interest?

Dennis
 
I've been following, but not participating in this thread and if my vote counts I would like to see the screen recording.

Y'all all rock.

Jim

I'm not satisfied until you're not satisfied.

(A paraphrase of DeMotivators)
 
I just tried with VFP 7, and I still don't see maximization getting remembered.

Here's what I did:

1) Opened VFP
2) MODI COMM an existing program
3) Maximize the window
4) Hit CTRL+F2 to bring the Command Window to the top
5) Typed Quit
6) Opened VFP again
7) MODI COMM the same program
 
Video en route. I need a few days ...

Dennis
(First VFP, then VFP+activeX, then VFP to html, then VFP to mySql+PHP+javascript)
 
It works in VFP9 running on XP.

The trick is when you open a .prg, DO NOT click the maxamize button, but resize the code window, now make a change and save it. if you reopen the .prg it will remember the size and position... these are written to the Foxuser.dbf
 
If you quit VFP and restart it and open the .prg... it will still open with the last size and position saved... Dont know if this is true in Windows 7 though
 
Imaginecorp --

I've been doing what you suggest --and it's ... OK. But it was so much nicer when a window would just pop in pre-maximized. Also, you get an extra 1/4" or so working space at the top because there is not top window bar. I remember my work flow was smoother with the "maximization feature" (that no one remembers but me...).

I haven't got the computer I need to do this yet (I needed another one anyway, so no biggie), but I'll have it soon and can do my Great Experiment.

Thanks for the input.

Dennis
(First VFP, then VFP+activeX, then VFP to html, then VFP to mySql+PHP+javascript)
 
Dennis,

I agree with you that a full-sized window is not as good as a maximised window. I always prefer to work maximised.

But why don't you just hit Ctrl+F10 as soon as the window opens? It's only one more keystroke, and after a while you'll be doing it without thinking.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top