Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to remove a page from a PF at design time
Message
From
02/10/2008 10:51:11
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01352266
Message ID:
01352270
Views:
23
I usually remove them at runtime doing something like this:
x =1
WITH THIS.PageFrame1   && is it pageframe1 or pageframe on your form?
     DO WHILE i <= .PageCount
         IF .Objects(i).Caption = "Page" && Add a check for your condition
             .REMOVEOBJECT(.Objects(i).Name)
         ELSE
             i = i +1
         ENDIF
     ENDDO
ENDWITH
However, there are times when I am usually more successful processing in reverse:
WITH THIS.PageFrame1  && is it pageframe1 or pageframe on your form? 
    FOR i = .PageCount TO 1 STEP -1
        IF UPPER(.Pages(i).Caption)='PAGE' && Add a check for your condition
            .REMOVEOBJECT(.Pages(i).Name)
        ENDIF 
    ENDFOR
ENDWITH
>I have a form with a page frame and 11 pages on it. The page frame is based on my own class, and the MemberClass and MemberClassLibrary for the pages on the pageframe are set in the properties of my pageframe class.
>
>I recently ran into trouble attempting to remove 2 of the pages from that pageframe using the form designer.
>
>When I tried deleting the pages directly from the form I got a message saying I couldn't do that because they were members of a class.
>
>So, in the form designer I moved the 2 pages I didn't want to the end, and then edited the pageframe class to reduce the pagecount from 11 to 9.
>
>But, then I was not able to then open the form in the form designer. I got an Error loading file message saying for one of the objects on one of the pages in the pageframe: Error loading file - record number 130. pfProjSubjDetail {or one of its membres}. Parent: object class is invalid for this container.
>
>Note that pfProjSubjDetail is a another pageframe on one of the pages of the pageframe class that I had just edited. But, not one of the 2 pages that I was attempting to delete.
>
>I went back and edited my pageframe class again, and changed the pagecount from 9 to 11, but I got the same error.
>
>I was able to get myself out of this by restoring the library containing my pageframe class definition from a backup tape.
>
>So, how do I remove these pages?
>
>Thanks for your thoughts,
>Jim
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform