Thursday, July 14, 2011

VFP Tricks: Adding Graphs and Charts into FoxPro Application

VFP Tricks: Add Graphs or Charts into FoxPro Application
Somehow any charts/graphs in an application would make a big difference for a user-friendly visual application. Also, sometimes it's very important to includes charts or graph in our applications.

Here an easy way for creating charts and graphs in Visual FoxPro application. We need take to take a look at SimpleChart control. You can download SimpleChart control (.zip) from link provided at the bottom of this post.

Visual FoxPro Tips: Programmatically Change Command Window Font

Sometime, we are bored with it's default Courier New font at Visual FoxPro command line window. Of course we can make a change to FoxPro's command window font with it's properties. But, this chance may be quite takes time. With a set of codes written in a .prg file, we can make font turnover with just one click or one Enter.

FoxPro Tips: How to Passes Parameters into FoxPro's Executable

Passing command line parameters from Windows to Visual FoxPro (VFP) created executable is different from passing parameters to FoxPro programs or functions in VFP application, as;

- All parameters are passed to .exe file as strings,
- Parameters should not be enclosed in a single quotes because
  quotes will be treated as part of a parameter,
- Parameters which contains spaces can be enclosed in double quotes,

Sunday, March 27, 2011

Using Own Icon In the Application ( .exe)

First you must provide your icon for your program. You can either use one of the collection included with VFP or create your own. To use one of the included ones, check out the graphics directory on your computer. For example, with the default installation of VFP6, the directory is "C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\".

To create your own icons, you need an icon creation utility. Gimp or IconForge is very powerfull image processing application to make any icons.

The images used for application icon must be 16 colors only. If you use 256 colors, the FoxPro logo icon will be shown instead of your own. You must also include the correct size images in the icon.

An icon file can contain several images with different sizes. Windows selects the appropriate size to display the file. For example, if you are browsing a folder with Windows Explorer and you have your view set to "list" or "details", you will see the small version of the icon. However, if you're view is set to "icons" or "thumbnails", you will see a larger version. For VFP .exe files, you must create an icon with 16x16 and 32x32 pixels sizes.

When your icon is ready, then you must add it into your project. Click on the "Other" tab in the Project Manager window, click on "other files" and click on the "Add" button. Select "icon" from the file type drop-down then select the icon file and click on "OK".

Next add the icon to the .exe file. While your project is open, Press Ctrl-J to open the Project Properties Information box. Make sure to check the "Attach icon" check box and click on the "Icon" button to browse. Now use the Open box to select your own icon.

If you would like to change the title bar icon in Windows with that icon, add this code to the main program of your application project:

_screen.icon=".ICO"
Compile your project into .exe then browse the folder containing the compiled file in Windows Explorer to see how the icon looks.