Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Size of Application Window in FoxPro

Posted on 2013-12-29
5
Medium Priority
?
3,107 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 80 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 320 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 43

Accepted Solution

by:
pcelba earned 1600 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 43

Assisted Solution

by:pcelba
pcelba earned 1600 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

885 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