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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Command and Visual Foxpro Screen

Status
Not open for further replies.

GirishSharma

Programmer
May 15, 2022
11
0
0
IN
Visual Foxpro 9
How do I hide command and Visual Foxpro screen, on the running of a form (form, not a programme). I have tried almost all given solution(s) in the forum as well as in some other links, but my question is I want to hide the command window and Visual Foxpro main screen when my form loads and unhide when I executes thisform.release on exit button click.
 
This is easy. Just include this code in the form's Init:

[tt]_SCREEN.Visible = .F.[/tt]

To restore the screen when you close the form, put this code in its Destroy:

[tt]_SCREEN.Visible = .T.[/tt]

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Caution, when the form is in screen, it's hidden together with the screen, and then you better kill the VFP9 process or the screen might still be invisible when you restart.

Chriss
 
You shouldn't care for the command window, as in an EXE the command window will not be present. It's only part of the Foxpro IDE (that is VFP9.exe).

The command window will also not show if your form is made modal (WindowType=1 vs 0) or if it's not modal and you run code that has a read event after starting a nonmodal form:

DO FORM yourform.SCX
READ EVENTS

Notice, this also then should be the only read events of the whole application. If your form starts other non modal forms, there is no need to put READ EVENTS into a button click or whatever code starts that form, the first READ EVENT is the read state for everything, so it's usually put into a main.prg you set as "Set Main" by the context menu of project items. That's the first thing staarting in an EXE. There's no point to make a form the main project item, by the way, as the form can't call it's own READ EVENTS. Which tells you that this isn't like the legacy READ states you had in screens. This has become obsolte.

The _screen can be part of an EXE, it could be your major application form that is just a main parent window for all your forms with your own application menu replacing the system menu. If you don't want to use this but only your own form for the EXE you can make one main form a top level form by setting the ShowWindow property to 2. Then you can also have a config.fpw file you can embed in the EXE or place it into the same folder as the EXE and have SCREEN=OFF in it, so you don't even have to program _screen.visible =.f., but that will only act on the EXE.

The screen and command window are you development environment, it's not a good idea to hide them while you work on your project. If your form is large and the command window is in your way, while the system menu is active you can close it with the X button of the title bar, of course, and show it with the menu hot key CTRL+f12, as is shown in the Window menu of the system menu.

I do that all the time when the command window gets in the way, but the screen did never disturbed me. Maybe because I already know how to use or get rid of it in the EXE version I can build.

Besides that you can dock forms in the IDE, and if the command window is docked to the right side, for example, forms you start will not be overlapped with it. By the way, you can also dock command window, property window and datasession window into one window and then have tabs to change between them.



Chriss
 
Caution, when the form is in screen, it's hidden together with the screen,

Quite right. I forgot to mention that.

GirishSharma, you will need to set the form's ShowWindow property to 2. Do that either in the form designer or in the form's Init.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Me said:
you will need to set the form's ShowWindow property to 2. Do that either in the form designer or in the form's Init.

Sorry, another mistake on my part. You can't set ShowWindow at run time. You have to do it at design time.

GirishSharma, to summarise, here is what you need to do:

1. In the form designer, set the form's ShowWindow to 2.

2. In the form's Init:

[tt]_SCREEN.Visible = .F.[/tt]

3. In the form's Destroy:
[tt]
_SCREEN.Visible = .T.[/tt]

Chris has made some good points re READ EVENTS, etc., but what I have posted here is all you need to know in order to answer your question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
All other approaches to hiding the main foxpro screen come from people who are not correctly using Readevents, but are making the main form modal instead.

That wasn't my suggestion. I suggested making it a top-level form. As I'm sure you know, top-level forms are always modeless.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top