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

Creating Forms - Designer vs. Programatically

Status
Not open for further replies.

toddsevans

Technical User
Aug 20, 2004
19
US
Hi,
I'm just starting to really get my feet wet with VFP7. I have been using the form designer to create forms because it seems much easier.

I notice that in the code examples here people are often using code to create their forms.

Can someone discuss the pros and cons of each approach?

I have already run into one con of using the form designer - it makes debugging a challenge.

Thanks for any insight.

Todd
 
Hi Todd.

In what way does the form designer make debugging a challenge?

The reason that people post code examples using code to create their forms on this forum is that you cannot post an scx ;-)

Personally, I use the visual tools to create visual objects. There is a reason that they are called visual designers ;-)



Marcia G. Akins
 
I also use the designer. I find it easier.

That being said, my understanding is that forms created using code instantiate faster.

Regards,

Mike
 
Mike,
Unless your forms are extremely complex (usually a bad idea) or your users have very slow (old?) machines, I doubt that you'd be able to tell the difference. There are also techniques that can make visual forms load quicker depending on where the slow down is.

Rick
 
Maybe my debugging skills are the problem.

If I create a new form and I want to debug the VALID event for a text box I copy the code into a prg and run that in the debugger. If the event calls an object created outside of the event I get errors like c:\...\investor_data.scx does not exist.

I am not using the full path in my DO FORM commands but maybe I should?

Also unless I run the main program file there are all sorts of undeclared variables and unopened tables.

How do you debug a subsection of code or a single form?
 
Rick,
why is it a bad idea to have extremely complex forms?

Todd
 
Todd,

SET STEP ON at the point where you want to invoke the debugger.

Regards,

Mike
 
Todd,
Complex forms usually confuse users AND it makes it harder for maintenance programmers (even when it's the designer!). Often multiple forms or a tabbed form (pageframe) can simplify a complex form. Also with pageframes you can delay instanitation of each page until the user actually choses it. That way if you have a number of pages you can substantially cut back on the load time.

Rick
 
I can't imagine doing an entire form in code. Just trying to properly align prompts and data entry objects would be a nightmare. You see code posted here because you can't post files or screen shots.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
Todd,

Although I nearly always use the form designer, there are a couple of reasons for doing the job the programmatically.

But it's not really a matter of benefits vs. disadvantates. It's a more a question of personal preferences and style of working. For example, some folk like to see all their code in one place while they are working on it. They prefer to be able to scroll to a particular piece of code and start editing, rather than clicking around until they reach a particular method.

For these people, writing forms programmatically is better because it's more in tune with their personal style of working, but that doesn't mean it's the right choice for anyone else.

Another reason is that SCX files have been known to become corrupted, and it can be time-consuming to restore them. PRG files rarely become corrupted. Again, that's not necessarily an overrding reason to go the PRG route. You might prefer simply to take more frequent backups.

I suggest you try using both methods and then decide which one you prefer. I suspect you'll come down in favour of the visual approach, but it's entirely up to you.

Either way, let us know what you think.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top