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

VFP FORMS 1

Status
Not open for further replies.

janak vyas

Technical User
Jun 3, 2020
47
IN
(never used forms) Is there any tutorial or any books or any guide/articles where I can learn how to make forms?
I wanted to make an accounting project customized for my personal needs. Tried searching projects that I could download and learn from them, but all goes above my head.

I am not able to implement search feature in the forms, not able to update the dbf's with new records neither edit, ...... please help.
 
There surely is a lot to learn about the object model of forms. More so on the controls and mainly then how to bind data to them.

The first simple getting started form could be doing this.

Open up the form designer and then first go into the data environment of the form. Add a table ther.

Put the two windows of the data environment and the form design side by side and drag a single field on the form canvas. VFP creates a textbox bound to the field.
Drag in the whole table and a grid is created.

That's already runnable.

About the detail problems you mention I donÄt see a direct connection between them and forms, searching data is still executing LOCATES or other such commands and has no dependency on what frontend you use. Controls like the listbox, grid, combobox even do support a feature called incremental search, it's even .t. by default and when items are sorted that means typing them in incrementally puts the active item/row to an items starting with what you typed in.

There are also the VFP sampes explaining a lot.

Otherwise you question is a bit vague, it helps when you come up with detail problems to help about them.

I suggest you read the help on a bit of events happening in the object model:
Properties Controlsource/Recordsource/Rowsource,Value and more you find on the data tab of the property window while you select a control on the form.
TabOrder for activation of controls with TAB (keyboard usage of forms)
events: Init(), When(), GotFocus(), InteractiveChange(), ProgrammaticChange(), Valid() and LostFocus().

Overall you need to get used to not having a single flow of code executed one after the other step. The form inits, then things happen, forms are event oriented you write code into single controls to react to events and in most case you just set up binding to fields and have no code at all, the control then already does write what you type into the dbf field. And that's not a small portion of how this works, you mostly only write code into buttons Click() events to do what you want to be done when the user clicksafter having entered something, for example a search term. This differs extremely from writing screen code, but I mainly can only say so from reference of what I read others saying about that, I don't have the direct comparison.

Bye, Olaf.

Olaf Doschke Software Engineering
 
About book references: There always is Hentzenwerke. Besides, I don't know a book specifically about forms. Forms will always be a chapter in a general book going through al the components of VFP applications like database, menus&toolbars, controls, forms, reports. The "new in version" books don't have much as controls and forms didn't advance much since VFP6, the only major upgrade was Docking and Anchoring and Docking is usable solala. The hacker guide sure has a lot on all kinds of topics, but very mixed.

So almost any general book even just about VFP6 would do. But the help already has a lot.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hi,
I advise you to read "1001 Things you want to know about VFP"
Stay healthy,
Koen
 
I advise you to read "1001 Things you want to know about VFP"

Sorry to disagree with you, Koen, but while "1001 Things" is an excellent book for intermediate and advanced programmers, it is not aimed at novices and was never intended to be. There is no specific information about designing or running forms or even how to launch the form designer.

It does have a good chapter on object-orientation which Janak might find useful, but even that assumes some existing experience.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Another tip for learning but also long term for productivity within form editing:

There's the need to not only study some properties and their meanings to know hem by heart, there's also a tool very dedicated to them: The properties window. One way to see its benefit is to use it after you exercised getting a data-bound control on your form by dragging from a table in the data environment to the form, as I suggested earlier.

You should then put up the property window in parallel to the form desinger. You might even be a little familiar with it, I don't know, but like the project manager it has a few tabs, one of them is "All", the other tabs filter this list by topic, and that alone is worth looking into, as the data tab obviously has everything important about data and data binding.

On top of that, the property window allows you to look at the essential properties used by being changed from their default. That can be very few properties and you get a nice overview of them. Right-click anywhere in the header section above the pageframe and pick the option "Non-Default Properties Only" from the context menu. Now you get an overview of what properties are actually used, especially for the data binding.

On top of that, the property window will give you shorthand descriptions of any property and what it means in the footer (if you don't uncheck that in the context menu). And you can organize yourself a bit there and specify some properties to be your favorites appearing in the favorites tab. Just right click on any property of any other tab and you have the option "Add to favorites", which also makes the property window a shortcut to those properties. It's a good idea to have the properties window open all the time. One other simple feature of it is double clicking on any method or event it lists you get into the editor.

Bye, Olaf.

Olaf Doschke Software Engineering
 
And there is one resource that is too often forgotten: The VFP Help file.

Start with the topic named "Creating Forms". Although this does not contain any hard information, it does have pointers to other, more practical, topics.

Another tip: whatever resource you use for learning about forms, ignore any mentions of form sets. These are rarely if ever used, and will only serve as a distraction.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Indeed, Mike.

Just to get a hint on what extent the VFP help has in comparison with book pages. You can take 7-zip to open a CHM file and extract its content (because a CHM at its core is an archive of some files, mainly HTML files). In the HTML subdirectory you find 4786 HTML files.

So when you think of 250-500 page books, the VFP help is a library of about 10-20 books. If you don't find your way into forms just because there is no tutorial and you only use the help as a reference, you're missing to navigate into sections like "Using Visual Foxpro" and drilling a few levels down, "Creating the User Interface"/ Working with Forms". This is much more than just the reference of commands and functions and classes and their properties and events and so on.

using_vfp_uwd58e.jpg


Just use the help as a book from its root content treeview, not just by search, and you find a well organised hierarchy of topics that are not merely reference material.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top