Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 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: 416542 # Views: 33 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Tuesday, December 30, 2014 9:51:17 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?
>
> 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.


Good Morning Dan,

While Mike is right, that does not mean that you need to go away from it. For one there is AS clause to activate intellisense:

WITH oContol AS commandbutton
  .Left

ENDWITH


Now, you can do this as well. Follow Mike's advice then later insert and enclose those with with... endwith, perform a search and replace to remove repeated objects within that enclosure such as in your case replace oControl. With .

Then beautify.

It is not only about WITH...ENDWITH. You'll encounter tracing problem as well on an SQL SELECT inside a TEXT....ENDTEXT. Or any codes within it as those are treated by vfp as text and not commands, function and the likes. It won't give you any error as well when there is supposed to be one and the solution is to temporarily remark TEXT and ENDTEXT. Or copy the sql select and paste it over command window and check from there.

With those minor problems, I personally still prefer using the two when i need those. With for easier readability and grouping plus faster and the TEXT.. approach for some of my combobox having rowsourcetype of sql select.

Just my own preference.



https://vfpx.codeplex.com/releases/view/99045
http://sandstorm36.blogspot.com

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