Solved

Size of Application Window in FoxPro

Posted on 2013-12-29
5
2,238 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Microsoft Outlook is not just an email client but it is full featured Personal Information Manager. But sometimes Outlook gets disconnected and you simply can’t access it. What steps can you perform before calling IT support? In this article we will…
Microsoft Outlook provides an easy way to recover permanently deleted items. When you empty the Deleted Items or simply deleted an Outlook data items using shift+Del key then it can be recovered using Registry Key settings.  Caution- Wrong Registry…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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