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 11:46:05
 
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:
01352294
Views:
19
Ok, do you have safe backups? You might try a different order:

1. Delete the two pages in the subclassed pageframe on the form in the form designer.
2. Open the class and delete the two pages in the parent class.
3. Try to open the form again.

Not sure it will make any difference, but I don't have anything to work with to test it for you.


>Do you mean in my pageframe class? I tried that originally. That made the form unable to load by the form designer.
>
>My pageframe class does very little except set values for MemberClass, MemberClassLibrary, and PageCount. The content of the pages is specified in the Form Designer.
>
>When I change the PageCount in the pageframe definition, the form becomes unable to load. And, continues to be unable to load even after I change the PageCount back to its original value.
>
>I'm thinking that the error message that I get is misleading, i.e. that the class of the Parent (a page on my pageframe) is not valid for this container (my pageframe). Actually, I think the class of that particular page is valid for that pageframe. But the form sill has info about the pages at the end of the pageframe that are not there in the class definition.
>
>Kind of a circular problem: I can't delete pages from the pageframe in the form designer because they are members of a class. But, if I delete them from the class defintion, then the form becomes corrupted.
>
>Seems to me that what I should have done was to put all of the content for these pages in the class definition of my PageFrame. But, that doesn't make sense: the whole idea of a class is that we derive objects from them, and then enhance those instances.
>
>
>Jim
>
>>Can you remove the pages in the parentclass then?
>>
>>>Tracy,
>>>
>>>Your reply kind of confirms that this is not a trivial question. I thought that maybe I was missing something. (Maybe I am!)
>>>
>>>I would prefer to do this at design time. These are pages that we originally intended to use, but during the developmet cycle found we no longer need. Seems a shared to keep them around and have to write code to clean them up.
>>>
>>>Jim
>>>
>>>>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
Reply
Map
View

Click here to load this message in the networking platform