Visit our new web pages

We have launched a new extended set of web pages at www.alvechurchdata.co.uk. These old pages will stay on the server because people still have links to them but they will not be updated.

The new version of this page is at www.alvechurchdata.co.uk/hints-and-tips/foxbuildproj.html.

A button to build a project


The Visual FoxPro desktop is an object itself and is represented by the _screen keyword. It has properties such as _screen.backcolor and _screen.caption to alter its appearance but you can also treat the desktop as a container and add objects to it. A button on the desktop can be a very useful shortcut:

[Button on VFP desktop]

The code below puts a button on the desktop and binds its Click event to code that will build the executable.

Public oHandler

*-- We don't want to see progress reports as the
*-- button object is created.
Set Talk Off

oHandler = Newobject ("ClickHandler")

With _Screen
  .AddObject ('cmdBuild', 'commandbutton')
  Bindevent (_Screen.cmdBuild,"Click",oHandler,"Build")
  With .cmdBuild
   *-- Set the appearance of the button first ...
   .Caption = "Build"
   .Top = 10
   .Left = 10
   .Height = 27
   *-- ... then make it visible.
   .Visible = .T.
  Endwith
Endwith

Set Talk On

Return

*----------------------------------------
Define Class ClickHandler As Session
  Procedure Build
   Build Exe webadmin.exe From webadmin Recompile
  Return
Enddefine

The button saves the four or five mouse-clicks needed to build an executable from the Project Manager. It might not save much time on a single build but the savings build up during the day.

Use the startup technique described here to add this button as Visual FoxPro loads. Back to FoxPro Developers' page


Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map