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

How to hide the Command Window on design time

Status
Not open for further replies.

TheBlainer

Programmer
Aug 31, 2011
37
CA
Hi,
I'm working on Visual FoxPro for several months and I'm tired to always close the Command Window when I open FoxPro to edit my project or a form or anything else except when editing dbf.
I found the command "HIDE COMMAND WINDOW", but I have no idea here to put it.
I know the config.fpw, but I don't know what to write in it.
Can someone help me to hide or close the Command Window when I open Foxpro please?
Thanks.
 
Right click on the title bar, uncheck "Dockable", now you can close the command window. Ctrl+F2 will show it again.

Bye, Olaf.
 
Thanks Olaf for the "Dockable" properties, it helps.

But the Command Window still open when I open FoxPro.
Is it impossible to hide it immediatly when FoxPro open?
 
To hide the window on startup, execute this command:

Code:
HIDE WINDOW "command"

You can do that in a startup program (which is executed automatically whenever VFP starts). Or you can place the command in the COMMAND= line in a Config.fpw file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks again to help me, but it doesn't work :(
I created a prg that contains your line and I put it in the startup program, but I get the error when I start FoxPro :
'Window "COMMAND" has not been defined.'

I also put your code
COMMAND=HIDE WINDOW "command" in the config.fpw in :
C:\Program Files (x86)\Microsoft Visual FoxPro 9\Samples\Servers\Foxisapi\Foxis
but still nothing. I created a new one in my project with the line and still nothing.
I must do something wrong, because it seems simple with the information you have given me. Does someone know what is it?
 
Strange. I just tried doing it myself, and it worked fine.

You said you put the command in your startup program. Are you sure you are correctly referencing that program in your startup sequence? The easiest way of doing that is to go to Tools / Options / File Locations, and enter the full path and filename against Startup Program.

You could also try to amend the program as follows"

Code:
IF WEXIST("Command")
  HIDE WINDOW "Command"
ENDIF

That should get rid of the error message, but I can't see why that should be necessary.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Instead of changing cofig.fpw in C:\Program Files (x86)\Microsoft Visual FoxPro 9\Samples\Servers\Foxisapi\Foxis

Simply create a config.fpw file anywhere you want, eg in you user documents.

The command actually just is HIDE WINDOW "command"
COMMAND= is just the prefix in the config.fpw to tell VFP this is a command to execute.

To make the config.fpw working simply double click it or start VFP9.exe with the switch -C. That is create a link file and specify -Cconfig.fpw (file name directly after -C without space, you can also include a path).

Don't change the config.fpw in some Samples code, just because you found one such file there. A config.fpw is a general configuration file, not just for VFP itself, but you can use it for any EXE or APP, so don't change this file meant for the configuration of the Foxisapi Sample. It's no big harm, as you might never use this Sample, but it's of course also not changing anything in regard to the IDE.

Bye, Olaf.
 
Now, with your new code, the warning has disappeared but the command Window has not.
I think that my startup program is called before the command window.
What I did exactly is :
1. I created a program called Hide_me_this.prg at the same place where my project is
2. I put your code in it
3. I went to Tools / Options / File Locations / Startup Program
4. i put the full path of the file
5. I clicked on Set as default and OK
After that, I close foxpro and open it again and the command Window is still there.

Sorry for asking so much help, but I really don't want to see the Command Window again when I open FoxPro.
 
Olaf I saw what you wrote after i submit my post to respond to Mike, so i'm telling you my response to you in this second post.

I understand what you're saying, but I don't know what you mean by "start VFP9.exe with the switch -C". How can I put a "switch" when I start it?
Thanks for your help
 
The term switch comes from way back DOS times and is not foxpro specific. In DOS you call commends, some part of cmd.exe some their own seperate EXE and these commands often have switches, simply parameters. eg DIR /A. And VFP accepts several command line switches. You find more in the help.

Eg VFP9.exe -Cyourconfig.fpw starts VFP9.exe with a config file named yourconfig.fpw

I've tested that and it worked for a command like ? 'Hi', but HIDE WINDOW "Command"

Let me suggest you to pull that window aside, you can even pull it outside the main screen and your desktop.

Bye, Olaf.
 
Thank you all for your help, but I think I will just continue to close the Command Window or pull it off my screen because nothing has worked.
 
I'm surprised no one has asked why you want to close the Command Window in the Development Environment? It's one of the most powerful tools VFP offers since you can try almost any code there and get it working before putting it into a program.

What bothers you about having the Command Window open?

Tamar
 
Well Tamar, my work is to maintain an old FoxPro application. Most of the time, I will edit forms in a project and test the application. So I don't need the Command Window to do this. Also, each time I run my application and close it, it's closing my project, because it does a clear and quit. So, I have to open the project often and have to close the Command Window several times a day.
I especially don't like the Command window, when I execute the application (that are .app and not .exe) and that's in front of it and doesn't want to close sometimes.
So that's why I asked for a way to hide it when I open FoxPro.
 
The command window staying visible when you call a form is a sign, that the forms you start are not modal. That's no error and I would even keep it that way, but in the end, if you compile to some exe or app and start it and the command window stays open you don't have a READ EVENTS and no modal start form or anything.

If that's the case, VFP returns from the initiall call (or the click on the Run button or ! toolbar button) the command window get's visible again.

If you start a modal form that will autohide the command window, if you start a main prg with READ EVENTS that will also hide the command window. If it does not hide it means the EXE you would produce would not stay in memory, the app will start and finish right away.

Bye, Olaf.
 
TheBlainer,

If you are seeing the command window while the application is running, that suggests that the command window is dockable. Olaf mentioned that possibility earlier in the discussion, but it would be worth checking. Just right-click in the window's title bar; if there is a tick against "Dockable", remove it.

In general, when you run an application (or, more specifically, a PRG file), the command window should close, unless it's dockable. That also applies to running an APP file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Also: unchecking dockable is permanent, and the command window staays behind forms or the form designer, if not set dockable.

Bye, Olaf.
 
I don't know why but sometimes the Command Window is back to dockable mode after I uncheck it. I mean that I open and close FoxPro several times and "what a surprise" is back to dockable.
Indeed the command window disappear when I run my app with the read events even if it's in dockable mode and it also stay on my screen when I click on run. So you're right Olaf.
I also want to say that most of the times, I want to make disappear the command window in my project (70% of the times I would say) So it's not on running my application my problem but on editing my poject.
 
OK, here's another suggestion. TheBlainer, you say the problem mainly occurs when you are editing your "project". I take that to mean when you are in the form designer, class designer, or some similar tool.

If that's right, I assume you always have the property window open at that time. If so, why not dock the command window and the property window together in a tabbed dialogue. That way, you can keep the property window in front, and never see the command window (unless you click on its tab).

To do that, make both the windows dockable. Then drag the property window over the command window, and let go of it as soon as you see an outline of a tab at the bottom of the window (it might take a bit of trial and error the first time you do it).

Then, go one step further, and repeat the process with the document view window. And even the data session window. These are all useful windows to have open in the development environment, but by docking them together, they don't take up any more space than one of them by itself.

If you are happy with that arrangement, just leave it like that the whole time. VFP should remember the setting, and restore it each time.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I don't know why but sometimes the Command Window is back to dockable mode after I uncheck it. I mean that I open and close FoxPro several times and "what a surprise" is back to dockable.

The first thing I do when I newly install VFP is uncheck Dockable for the Command Window and it never becomes dockable again. So, it must be something you're doing that's making it dockable again. Maybe something to do with your resource (FoxUser) file? Maybe whether you have RESOURCE ON or OFF?

When you're working on your project, having the Command Window available is really helpful. I use it not only for testing, but when I'm debugging.

Tamar
 
That's a pretty useful trick Mike that you have said.
I think that I will keep this the way you showed me.
But by default if I open a form or my project, it's the Command Window that show first on the screen and not the Properties Window.
Do you know if we can choose which of them has to appear?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top