Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 To: Sergey Karimov
  Where is Sergey Karimov?
 Reston
 Virginia - United States
 Sergey Karimov
Subject: RE: create object programatically
Thread ID: 99991 Message ID: 100157 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Friday, June 30, 2006 12:54:08 PM         
   



> Absolutely agree with those guys about maintenance. I don’t use any visual tools as well. And I'm adding another sentence – using .prg gives you a real flexibility. In fact I don’t understand how to create visually e.g. Order Entry form, when 80% of data is the same for all customers, but 20% is absolutely different. In .prg file you can do it easily.
> Or another little sample – lets assume you use txtPhone objects of class TextboxPhone in 40 forms. Now you decided instead of txtPhone to use cntPhone - a container with txtPhone and btnPhone to dial up. It means you must open in your wizard all 40 forms and manually do changes and adjust all objects. But with .prg files you just run Filer utility and do replace command 'TextboxPhone' --> 'ContainerPhone', 'txtPhone' --> 'cntPhone' and then '.cntPhone' --> '.cntPhone.txtPhone' That’s it! Belive me it will take less then 10 minutes.


This is, if you will pardon my bluntness, total nonsense! There are a lot of beginners who read this forum and you should not be making statements like this - it is not only bad practice, it is very poor technique and, quite simply, wrong!

Your example is not only stupid, it is positively dangerous, anyone that uses FILER to make global changes to code like this is simply asking for trouble! One really good way to propagate un-traceable bugs throughout your code is to follow your recommendation.

The correct way to handle this is to use a visual container class in the first place, then, when you need to change it, you simply change ONE class definition and all instances of that class inherit the change. Even if you had added the objects to forms directly and then need to change them, you can still do it programmatically even easier than you can in a PRG - it requires exactly 4 lines of code and NO additional tools:

USE xxxx.scx
REPLACE class WITH newclass FOR
USE IN xxxx
COMPILE FORM xxxx

May I suggest that if you insist on parading your shortcomings that you do it somewhere a little less public.

Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA

ENTIRE THREAD

create object programatically Posted by Ryan Lashway @ 6/29/2006 2:34:16 AM
RE: create object programatically Posted by mike castillo @ 6/29/2006 6:40:23 AM
RE: create object programatically Posted by Andy Kramek @ 6/29/2006 12:59:19 PM
RE: create object programatically Posted by Bernard Bout @ 6/30/2006 5:28:07 AM
RE: create object programatically Posted by Marcia Akins @ 6/29/2006 1:16:50 PM
RE: create object programatically Posted by Ryan Lashway @ 6/29/2006 2:37:30 PM
RE: create object programatically Posted by Boudewijn Lutgerink @ 6/29/2006 4:13:23 PM
RE: create object programatically Posted by Ryan Lashway @ 6/29/2006 4:34:31 PM
RE: create object programatically Posted by Martin Sellwood @ 6/29/2006 4:58:31 PM
RE: create object programatically Posted by Andy Kramek @ 6/29/2006 7:15:50 PM
RE: create object programatically Posted by Dexter Carlit @ 6/29/2006 7:29:37 PM
RE: create object programatically Posted by Ken Murphy @ 6/30/2006 2:00:32 PM
RE: create object programatically Posted by Ravi Taxali @ 6/29/2006 4:50:39 PM
RE: create object programatically Posted by Martin Sellwood @ 6/29/2006 5:01:04 PM
RE: create object programatically Posted by Andy Kramek @ 6/29/2006 7:23:58 PM
RE: create object programatically Posted by Marcia Akins @ 6/29/2006 8:13:16 PM
RE: create object programatically Posted by Sergey Karimov @ 6/30/2006 1:23:37 AM
RE: create object programatically Posted by Boudewijn Lutgerink @ 6/30/2006 11:44:38 AM
RE: create object programatically Posted by Sergey Karimov @ 6/30/2006 4:22:38 PM
RE: create object programatically Posted by Boudewijn Lutgerink @ 7/6/2006 8:36:54 AM
RE: create object programatically Posted by Sergey Karimov @ 7/6/2006 5:15:06 PM
RE: create object programatically Posted by Bernard Bout @ 7/1/2006 2:56:54 AM
RE: create object programatically Posted by Andy Kramek @ 6/30/2006 12:54:08 PM
RE: create object programatically Posted by Sergey Karimov @ 6/30/2006 4:38:28 PM
RE: create object programatically Posted by Andy Kramek @ 6/30/2006 7:00:51 PM
RE: create object programatically Posted by Bernard Bout @ 7/1/2006 3:04:40 AM
RE: create object programatically Posted by Andy Kramek @ 7/1/2006 1:16:01 PM
RE: create object programatically Posted by Ken Murphy @ 7/1/2006 1:56:31 PM
RE: create object programatically Posted by Andy Kramek @ 7/1/2006 3:45:04 PM
RE: create object programatically Posted by Ken Murphy @ 7/1/2006 6:17:21 PM
RE: create object programatically Posted by Ravi Taxali @ 6/30/2006 3:34:45 PM
RE: create object programatically Posted by Ken Murphy @ 6/30/2006 5:12:54 PM
RE: create object programatically Posted by Ken Murphy @ 6/29/2006 1:23:06 PM
RE: create object programatically Posted by Gianni Sassanelli @ 6/29/2006 9:06:17 PM
RE: create object programatically Posted by Boudewijn Lutgerink @ 6/30/2006 11:48:48 AM
RE: create object programatically Posted by Borislav Borissov @ 6/29/2006 1:40:19 PM
RE: create object programatically Posted by Pete Sass @ 7/11/2006 4:13:37 PM
RE: create object programatically Posted by Dexter Carlit @ 7/12/2006 1:45:42 PM