wpe1.jpg (3346 bytes)
Microsoft FoxPro site

Microsoft FoxPro
HELP
Sources for Quick Answers

Google
Advanced

>The Report Toolbar does not show up in an EXE using Modify Report to enable the report building

Mike Lewis below shows how the FOXUSER.DBF/FPT controls whether the Toolbar shows up or not.  You can do the steps he outlines, then copy the FOXUSER files to REPOUSER.DBF/FPT.  Then SET RESOURCE TO REPOUSER before modifying the report, then Set Resource back to FOXUSER when done.

Rick Shaddock


Enable report toolbars at run-time

Visual FoxPro lets you open the report designer in your application. But can you be sure the correct toolbars show up?

VFP developers sometimes like to give their users access to the report designer at run-time. For the most part, this is no more difficult than executing a MODIFY REPORT command from within an executable. Too often, though, the report designer will appear correctly, but the related toolbars will be nowhere to be seen.

In general, to control the visibility of toolbars at run-time, you use SHOW WINDOW and HIDE WINDOW. For example:

HIDE WINDOW "Standard"

to hide the standard toolbar, and

SHOW WINDOW "Standard"

to make it visible again.

Unfortunately, these commands only work if the toolbar has already been opened during the current session. If it hasn't, VFP generates error 1714 (Window not defined). As you've got no way of programmatically opening the toolbars in the first place, these commands won't solve the problem.

Nor can you give the user access to the standard Toolbars dialogue from within an executable. It's true that you can create a menu with the Toolbars prompt on it, but this will be greyed out when you run the program.

The solution turns out to be quite simple. To understand it, keep in mind that the current toolbar status - that is, the visibility and location of the toolbars, and whether they are docked or floating - is stored in the VFP resource file. The resource file is in fact two files. By default, they are named FOXUSER.DBF and FOXUSER.FPT and can be found in the directory from which you launched the application.

With that in mind, here are the steps needed to ensure that the report designer toolbars are always visible at run-time:

  1. Launch Visual FoxPro. Close any toolbars that you don't want the user to see at run-time (such as the standard toolbar).
  2. Open the report designer. Go to View/Toolbars and manually open the two main report designer toolbars (Report Designer and Report Controls). Move these to a suitable location on the screen. If you wish, you can also open the Layout and Color Palette toolbars at this point, but this is not essential as the user will be able to open these from the Report Designer toolbar.
  3. Using Windows Explorer, visit the directory from which you launched VFP. Look for FOXUSER.DBF and FOXUSER.FPT, and make them read-only. (To make a file read-only, right-click on it, select Properties, and enable the Read-Only checkbox.)
  4. Quit the report designer and close VFP.
  5. Copy the two Foxuser files to the directory on the user's system from which your application will be launched.
  6. Launch the application on the user's system. When you open the report designer from within the application, you should see the toolbars just as you left them.

From now on, the user will be able to move the toolbars around, dock and undock them, and even close them. But because the resoure file is read-only, these settings won't be saved when the application exits, so the toolbars will always revert to their initial status when the application starts.

One last point. Be sure to remove the read-only flags on the original copies of the two resource files (that is, the copies in your VFP directory). If you don't, all the toolbars and windows in the development environment - including the command window, browse window, property sheets, etc. - will revert to their default settings whenever you launch Visual FoxPro.

Mike Lewis Consultants Ltd.  January 2001

 


In Reply to: Re: Standalone executable version posted by Eric den Doop on :
: : What are the files to be distributed with the standalone EXE created in vfp6 ? And where should (path) be copied it ?

: : Please reply!

: Search a bit more down on this webboard. Lots of posts about this stuff.

The only files needed with a standalone EXE is the three
VFP6*.DLL into the C:\windows\system and it's a good
idea to have CONFIG.FPW in the working directory. I found you need SCREEN=OFF in order for the toplevel form
to get immediate focus upon startup.

If you use anything like comm (MSCOMM32) or other OCX related stuff, you have to make sure you include them with the DLLs.

vfp600.dll, vfpenu.dll, vfpole60.dll

 


ASP for FoxPro Programmers
http://www.lespinter.com/Articles/English/226.htm


 

 

Return

.