Solved

Size of Application Window in FoxPro

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

9 Experts available now in Live!

Get 1:1 Help Now