Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: James Frye
  Where is James Frye?
 Wilmington
 North Carolina - United States
 James Frye
 To: Dan Baker
  Where is Dan Baker?
 Effort of the Poconos
 Pennsylvania - United States
 Dan Baker
 Tags
Subject: RE: EXMPL: Remove all Objects from PageFrame
Thread ID: 347216 Message ID: 365252 # Views: 37 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Sunday, December 23, 2012 2:35:43 AM         
   


> Foxites:
>
> Not much documentation found on using RemoveObject.   This was a tricky one for me to figure out.   Hope the code is useful to someone.
>
> Objective: Remove all Objects from the Pages in a Pageframe
>
>
> * * * * * * * * * * * *
> * pageframe_remove_all_objects()
> * * * * * * * * * * * *
> 
> LOCAL Pageframe,Page as String
> 
> Pageframe = "thisform.pgf1.pagTask.pgf1"
> 
> WITH &PageFrame
> 
> LOCAL oPage as Object
> FOR EACH oPage IN .Pages
> 
>   Page = m.PageFrame+"."+oPage.Name
> 
>   WITH &Page
> 
>     * Create a variable TotControls.  You can't use .ControlCount in the loop
>     *     because the .ControlCount goes down to zero as you remove objects.
>     TotControls = .ControlCount  
>     FOR j = 1 TO m.TotControls
>       .RemoveObject( .Controls[1].Name ) && Remove object #1 again and again 
>     ENDFOR 
>     .Refresh()
> 
>   ENDWITH 
>   
> ENDFOR   
>  
> ENDWITH   
> 
> 

>
> NOTE: One problem not solved by this: If you have some containers inside the Pages you want to remove, you need to drill down to a deeper level.   For pages with no other containers in them, this should work.
>
> Dan Baker

I use amembers function instead of controlcount as such:


lnFound = AMEMBERS( laObj, thisform.pageframe1.page6, 2 )
WITH thisform.pageframe1.page6
FOR lnCount = 1 TO lnFound
  loObject = laObj[lnCount]
  .RemoveObject(loObject)
  loObject = NULL
NEXT
ENDWITH





The best is yet to be.

Jim Frye

ENTIRE THREAD

EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 6/16/2012 4:09:53 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Samir H. @ 6/16/2012 5:06:08 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 6/16/2012 8:36:34 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Anders Altberg @ 6/16/2012 3:51:39 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 6/16/2012 10:47:07 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by David Mustakim @ 6/17/2012 12:14:01 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 6/18/2012 2:39:42 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Anders Altberg @ 6/20/2012 8:40:33 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 12/21/2012 11:30:23 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by David Mustakim @ 12/22/2012 5:04:31 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Anders Altberg @ 12/22/2012 1:18:08 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Tore Bleken @ 12/22/2012 9:44:44 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 12/22/2012 2:13:25 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Tore Bleken @ 12/22/2012 6:00:10 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Tony Vignone @ 12/22/2012 6:22:18 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 12/22/2012 6:37:31 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by Koen Piller @ 12/23/2012 11:58:42 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 12/23/2012 7:55:40 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by James Frye @ 12/23/2012 2:35:43 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 12/23/2012 3:38:54 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Rahul Moudgill @ 12/23/2012 6:47:03 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 1/12/2013 2:56:38 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by David Mustakim @ 1/12/2013 3:40:31 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by Dan Baker @ 1/12/2013 8:24:01 AM
RE: EXMPL: Remove all Objects from PageFrame Posted by David Mustakim @ 1/12/2013 5:48:43 PM
RE: EXMPL: Remove all Objects from PageFrame Posted by tushar @ 1/12/2013 9:08:15 AM