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!

How do you set screen attributes in a config file?

Status
Not open for further replies.

baseballgem

Programmer
Oct 3, 2001
54
0
0
US
The help says you can say this:

COMMAND =_SCREEN.Caption="Visual FoxPro " + VERS(4)
in the config file as an example of how to employ the COMMAND= statement. But, IT DONT WORK !

The TITLE = <expression> (without quotes around the expression)... Now that works.

Are their other ways to set certain attributes in the config file?
For example:
_SCREEN.fontsize = 9
_SCREEN.backcolor = 1243456
_Screen.icon = 'C:\etc etc\ myicon.ico'

None of these work in a config file even if you preceed it with COMMAND = ; Guess it doesn't like the object reference.
Any suggestions?
It's not a major problem.
I can say SCREEN=OFF and then in the launching program set the screen attributes and then issue _SCREEN.visible = .T. , no big deal, NEVERTHELESS the help file regarding the COMMAND= is in error.


 
baseballgem,

What version of VFP are you using? I just tried putting a config.fpw file into my VFP7 and VFP8 installation directories and both times it changed the caption or anything else I wanted to set for the _screen of VFP. Here was my last test to try and reproduce the behavior you are seeing:

COMMAND =_SCREEN.Caption="Visual FoxPro " + VERS(4)

...my VFP8 came up and showed the entire version number in the caption. You are doing this with the vfp8.exe or vfp7.exe (or perhaps earlier version of VFP since I am not sure when the command functionality showed up)?

boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
&quot;Whom computers would destroy, they must first drive mad.&quot; - Anon​
[/sup]
 
baseballgem,

The easiest way to do this sort of thing is to write a small PRG file that makes the necessary settings. In this case, the PRG file would contain:
_SCREEN.fontsize = 9
_SCREEN.backcolor = 1243456
etc.

Assume this PRG is called STARTUP.PRG.

Then, in your Config file, put this line:

COMMAND = DO STARTUP

I think that'll work.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
I am using VFP8.

also..Is it madatory that you put quotes in certain places or leave no spaces after or before equal signs?
I have a lot of lines in my config.fpw file. Is there a special place this should be placed, like always before or after the SET sets?

I'll have to try again at work. For the life of me I couldn't get it going.
I would have said exactly that you did but it ignores everthing I tried. I know it is using the correct config file for I have MVCOUNT = 2200 and sure enough that's what comes up when I display memory. Maybe things will be brighter on Monday.
 
I Just discovered something folks. Apparently you can't enter a set of commands.

COMMAND=_SCREEN.fontsize=12
COMMAND=_SCREEN.fontbold=.t.
COMMAND=_SCREEN.backcolor = 16773849

If you do this, the only one that will take effect is the last one. I was hoping one could set a group of screen attributes. Silly me; one can only execute one and only one "COMMAND=" setting.
 
Using something similar to what MikeLewis suggested (you can't just issue DO SETUP as VFP will look for a SETUP.EXE, at least that was my experience) I was able to get it to execute multiple commands, though there is something odd. In a setup.prg file I have the following:

_screen.Caption = "HELLO WORLD"
_Screen.BackColor=RGB(255,0,0)

...then in my config.fpw I had to put the following:

COMMAND=DO (home() + "setup.prg")

...the ODD thing that I refer to is that VFP8 will come up with an error message when started...it says "object AUTOCENTER not found"...however clicking past it and the caption of _screen is changed as well as it's backcolor. - (I place both files right inside the VFP8 home folder) - I am assuming that the use of the path in my command causes VFP to mess something up having to do with pathing. The command is messing up the default path perhaps?

In any event it is somewhat interesting, however I see little use for changing the backcolor or caption or even icon of the IDE when it first comes up. So perhaps these types of things weren't provided for as well as they could have been. Is there use for this or are you just curious why it won't allow multiple commands? I ask, because there may be a much more straight forward way to provide for what you are doing.

As to your questions, it does not appear that spaces around the equal signs (or lack of them) is mandatory and as for quotes, the only time I found that they should be included is when they would normally be included in the statement such as around "Hello World". This does appear to be a little diff than the help file since the syntax calls for a cVisualFoxProCommand which makes one think that the whole command should be enclosed in quotes which it should not...I suspect that VFP parses everything after the equal sign similar to the way an INI file is parsed (not exactly but you know what i mean).

boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
&quot;Whom computers would destroy, they must first drive mad.&quot; - Anon​
[/sup]
 
In the development environment, you can go tools -> options -> file locations -> startup program
 
Craigsboyd asked
"Is there use for this or are you just curious why it won't allow multiple commands? "
The answer:
I was just given an assignment that would employ the old fashion quik and dirty solution. Just allow someone to click an Icon; the program would upload data to an SQL database and then disconnect. A log would be kept in the background.
Well, I just thought instead of writing an interface I would use the native window with SYSMENU OFF, a different _screen title, a different _screen.font to echo progress to, and while I'm at it a nice soft pastel yellow backgound. I've done all these things it's just that I can't set those things in a config file. It's no big deal - just curious if there was a config work around. I'm not going to spend time worrying about it. So please don't spend time yourself.
I do sincerely thank all of you for your comments, even though I don't always have time to send a thank you back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top