Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 To: Dan Baker
  Where is Dan Baker?
 Effort of the Poconos
 Pennsylvania - United States
 Dan Baker
 Tags
Subject: RE: Simplify column style creation in cnt
Thread ID: 416471 Message ID: 416539 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Tuesday, December 30, 2014 9:21:00 PM         
   


> >
> > I'm really hesitant about WITH...ENDWITH. If you call a method in the with, and in that method you have a mistaken .Property, it falls back to the WITH. Very dangerous if unintentional.
> >
> > It's much clearer to...
> >
> >
> > op=Evaluate('o'+Transform(m.p))
> > oControl.Left = op.cmdMarginLeft
> > oControl.Width = op.cmdWidth
> > oControl.Top = op.cmdMarginTop + m.nTop
> > oControl.Caption = Icase(p=1,junk.country,p=2,junk.Region........)
> > 

> >
> > Mike Yearwood
> > Microsoft MVP Visual FoxPro 2008, 2009
> > We have enough youth. We need a fountain of smart!
> > There may be many ways to skin a cat, but there are very few right ways to do it.
>
> Hi Mike,
>
> Are you saying that WITH... ENDWIDTH is not good in this situation, or do you
> dislike it in general?

In general. It's too easily broken and not easy to fix. The performance "benefits" are obtainable without it.

WITH oControl
.One = 1
.Two = 2
.Three = 3
ENDWITH

is absolutely no different from

oControl.One = 1
oControl.Two = 2
oControl.Three = 3

Here's what I mean with the with risk.

WITH oControl
AnotherControl.Two()
ENDWITH

AnotherControl.Two()
THIS.Height = 1
.Length = 2


The .Length in TWO now refers to oControl! That is so ethereal it scares me.


>
> But I get what you're saying.  In fact, maybe the reason I couldn't figure out the
> problem was that I got confused about what object was referring to what.  So from
> the standpoint of less text, WITH... ENDWIDTH sounds great, but in terms of
> more understanding, you may be indeed be right.
>
> Cheers,
>
> Dan B.
>
> BTW, I'm working on your suggestion about the run-time modification of controls
> and should have something to show in a few weeks.
>
>
> P.S. From the sound of your tag line: "There may be many ways to skin a cat, but
> there are very few right ways to do it", you and my wife might get along great.  It seems
> like I can never clean the dishes the "right way." :- )  But I'm making progress in
> curing my ignorance.

Curing ignorance is the best each of us can do. :)

Mike Yearwood
Microsoft MVP Visual FoxPro 2008, 2009
We have enough youth. We need a fountain of smart!
There may be many ways to skin a cat, but there are very few right ways to do it.

ENTIRE THREAD

Simplify column style creation in cnt Posted by Dan Baker @ 12/30/2014 2:47:29 AM
RE: Simplify column style creation in cnt Posted by Jun Tangunan @ 12/30/2014 4:58:43 AM
RE: Simplify column style creation in cnt Posted by Dan Baker @ 12/30/2014 12:46:00 PM
RE: Simplify column style creation in cnt Posted by Mike Yearwood @ 12/30/2014 6:51:21 PM
RE: Simplify column style creation in cnt Posted by Dan Baker @ 12/30/2014 7:15:44 PM
RE: Simplify column style creation in cnt Posted by Mike Yearwood @ 12/30/2014 9:21:00 PM
RE: Simplify column style creation in cnt Posted by Jun Tangunan @ 12/30/2014 9:51:17 PM
RE: Simplify column style creation in cnt Posted by Dan Baker @ 12/30/2014 10:59:55 PM