Solved

Size of Application Window in FoxPro

Posted on 2013-12-29
5
2,154 Views
Last Modified: 2014-01-01
One of my old applications is now running on a computer with a much bigger monitor than I used before. And now, there is a lot of white space between my forms and the frame of the application window (which is not maximized). Apparently, it was not noticeable before because the size of the forms fit the old screen exactly, and the size of the application automatically fit the size of the screen. Now, there is a mismatch. How can I fix that? I would like the application window to frame my forms perfectly and to be centered on the screen.

Thank you.
0
Comment
Question by:VitalyNagy
5 Comments
 
LVL 19

Assisted Solution

by:basraj
basraj earned 20 total points
ID: 39745538
Is the application Visual Foxpro? If yes, please check this:

http://fox.wikis.com/wc.dll?Wiki~AutomaticWindowResizing
0
 
LVL 5

Assisted Solution

by:chanderpal singh rathore
chanderpal singh rathore earned 80 total points
ID: 39745554
There are two options.

First, in the Init of the form, put the following code:

CODE

WITH _Screen
  .Height = 400
  .Width = 600
ENDWITH


That will resize the outer window (the one with the blue bar) to 400 x 600 pixels. Obviously, you can put whatever figures you like here. But don't make it smaller than your form, otherwise the form will be clipped.

But I wonder if this is what you really want. If the outer window is not relevant to your application (in other words, if you only have the one form, and no other user interface such as menus or toolbars), it would be better to make the outer window invisible. So, put this into the Init of the form:

CODE

This.ShowWindow = 2
_Screen.Visible = .F.


And in the Destroy of the form:

CODE

_Screen.Visible = .T.


That way, the user will only see your form, and nothing else.

Mike
 

__________________________________
OR you can use this


If you are using a "config.fpw", it should contain a line with :

screen = off

make sure this file is included in your project. In other words, go tot he 'Other' tap on your project window. Under 'Text Files' the "config.fpw" should be present. If not "add" it to the project.

Set the property "ShowWindow" = 2 - As Top Level Form

compile and test
0
 
LVL 41

Accepted Solution

by:
pcelba earned 400 total points
ID: 39745768
Just a short clarification: You cannot execute  This.ShowWindow = 2  because ShowWindow property is read/only at run-time. So you have to decide about the window type during the design time.

Top Level Form also requires special handling of the system menu if you use it.

The _screen dimensions change seems to be the easiest change you can do... and you could do it even without any programming because the size of main application window is handled by Windows so if you start your app, resize the main app window into the size required and exit the app then Windows should remember the window position and dimensions for future use.

Of course, to change _screen dimensions programmatically is more sophisticated approach and you may adjust it in your form Init method the following way:

_screen.Height = THISFORM.Height + SYSMETRIC(9) + 2*SYSMETRIC(4)
_screen.Width = THISFORM.Width + 2*SYSMETRIC(3)

You could also think about the _screen Resize event binding to your code which will resize the main form. Code sample is under the BINDEVENT() function in VFP 9 help.  The latest help file is available here: http://vfpx.codeplex.com/wikipage?title=VFP%209%20SP2%20Help%20File&referringTitle=Home
0
 

Author Comment

by:VitalyNagy
ID: 39749185
Thank you. I have several forms and a toolbar. So, I would not like a windowless application.

How can I also ensure that the window is centered on the screen? (I am still using Visual FoxPro 6, by the way).
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 400 total points
ID: 39749832
To center the main VFP window just issue following command (after setting its dimensions):

_screen.AutoCenter = .t.

Hope this property is available in VFP 6. If not then you have to calculate _screen.Top and _screen.Left from SYSMETRIC(1) and SYSMETRIC(2):

_screen.Top = (SYSMETRIC(2) - _screen.Height) / 2
_screen.Left = (SYSMETRIC(1) - _screen.Width) / 2

To create several Top level forms each one having its own menu and toolbar is also an option. (Which requires some additional programming...)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best practices regarding backing up maintenance programming 20 121
outlook.exe 8 104
Cannot locate the COMSPEC environment variable 8 140
Windows mail 2012 - repeating message 4 39
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
MS outlook is a premier email client that enable you to send and receive the e-mails with various file formats of attachments such as document files, media file, and many others formats. There is some scenario occurs when a receiver of an e-mail mes…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now