Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Sergey Karimov
  Where is Sergey Karimov?
 Reston
 Virginia - United States
 Sergey Karimov
 To: Boudewijn Lutgerink
  Where is Boudewijn Lutgerink?
 Beemdhof, Heteren
 Netherlands
 Boudewijn Lutgerink
Subject: RE: create object programatically
Thread ID: 99991 Message ID: 100733 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Thursday, July 6, 2006 5:15:06 PM         
   



Dear guys,

You may kick me and tell me about that 'holy cow' inheritance, and about 'bad' design, but I don't see any reasonable answer to my very simple samples. The sample with txtPhone is very realistic, you may call it txtStatus, txtTotal, etc. Of course, some geniuses can foresee all objects and their hierarchy right in the beginning. But what to do when a stupid guy like me designed a form 5 years ago and didn't think about possibility to dial up?
As concern my first question – here is just a fragment from my Order Entry form Init event. All IFs there are customers options. And if you tell me, that I MUST create (subclass) forms for all combinations of these IFs then I'm sure, I'm lost immediately.

Regards,
Sergey

Fragment:

IF IfOrdtp()
.AddPair("cntOrdtp", "Type", "", .T.)
WITH .cntOrdtp
.Tag1= IIF(IfEurofase(),"tr_ordtp","")
.Init0()
.txtCode.MaxLength= IIF(IfEurofase(),.txtCode.MaxLength,1)
ENDWITH
.FitLayObj("cntOrdtp","U","cntDate", 2, "LL")
.FitLayObj("lblOrdtp","L","cntOrdtp", lh, "CC")

IF IfEurofase()
.AddPair("txtConfirmed","", "GldTextboxShow", "N")
.FitLayObj("lblConfirmed","R","cntOrdtp", 2*lh, "CC")
.FitLayObj("txtConfirmed","R","lblConfirmed", lh, "CC")
ENDIF
ENDIF

oTbl.BegInit(This, "R", "2", IIF(IfGenDisc() .and. !IfServlevl(),3,2))

IF IfGenDisc()
.AddPair("txtGendisc", "Gen.Discount %", "TxtOrAGendisc", "999.9")
.txtGendisc.ControlSource="ThisForm.Or_gendisc"
ENDIF

IF IfStoreDisc()
.AddPair("txtStrdisc", "Store Discount %", "TxtOrAStrdisc", "999.9")
.txtStrdisc.ControlSource="ThisForm.Or_strdisc"
ENDIF

.AddPair("txtCustomerPO", "Customer P.O.", "TxtOrACustomerPO", "MAN", LEN(or_custpo))
.AddPair("cntShipVia", "", "CntShipvia2") &&see shipvia.prg

IF IfServlevl()
.AddPair("cntServlevl", "Service level", "", .T.)
.cntServlevl.RelAlias= .Shipvia
.cntServlevl.Init0("R", lh, 2, "MAN", 15, "MAN")
ENDIF

IF !EMPTY(.Terms)
.AddPair("cntTerms","\<Terms","CntTerms2") &&see terms.prg
ENDIF

oTbl.EndLay("D","*B", 2, "*")
IF IfServlevl()
.cntServlevl.FitSetExpCoef("1","0")
ENDIF

oTbl.BegInit(This, "R", "2", 2)

.AddPair("cntSalesman", "", "", .T.)
.cntSalesman.Init0("R", lh, 4, "9", 30, "MAN")

.AddPair("cntReqby", "Required By", "CntOrAReqby")

oTbl.EndLay("D","*B", 2, "*")
.cntSalesman.FitSetExpCoef("1","0")

oTbl.BegInit(This, "R", "2", 1)

.FitAddObject("lblMemo","GldLabel", "M\<emo")
.FitAddObject("edtMemo","GldEditboxStd")
.edtMemo.FitSize(1, "", 4) &&4 lines
.edtMemo.Width= .cntCustomer.Width

oTbl.EndLay("D","*B", 2, "*")
.edtMemo.FitSetExpCoef("1","1")

.FitAddobject("cmg1","GldCommandGroup")
WITH .cmg1
.FitAddObject("btnDetail","BtnOrADetail", "Detail Items")
IF IfNucon()
.FitAddObject("btnCustomized","BtnOrACustomized", "C\<ustomized")
ENDIF
IF IfOrEDIManual()
.FitAddObject("btnOrdEDI","BtnOrAOrdEdi", "EDI Da\<ta")
ENDIF
IF IfLiqtrans()
.FitAddObject("btnLiqtrans","BtnOrALiqtrans", "\<Transactions")
ENDIF
.FitAddObject("btnPrint","BtnOrAPrint", "Print")

.FitSizeEqual(4,4)

IF TYPE(".btnCustomized")="O"
.FitLayObj("btnCustomized","D","-1", 2, "CC")
ENDIF
IF TYPE(".btnOrdEdi")="O"
.FitLayObj("btnOrdEdi","D","-1", 2, "CC")
ENDIF
IF TYPE(".btnLiqtrans")="O"
.FitLayObj("btnLiqtrans","D","-1", 2, "CC")
ENDIF
.FitLayObj("btnPrint","D","-1", 2, "CC")

.FitSize(4,4,4,4,.T.)
.FitLay("R","edtMemo", lh, "TT", 0)
ENDWITH


>
> > As I understand you know a 'magic' method to do such a changes without opening all 40 forms?
>

>
> There is no sugar, ahem, NO MAGIC in it, there is a simpel case of separating behavior and UI.
> read the articles on Hooked on Objects in the article section first. There is sample code included.
>
> Boudewijn Lutge®ink
> My Blog is here
>


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