Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing Pages from Pageframe at run time
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01665827
Message ID:
01665834
Views:
50
>>>>Hi,
>>>>
>>>>I have a form with a pageframe and 4 pages: Page1, Page2, Page3, and Page4
>>>>
>>>>Sometimes (depending on the user setup) I want only pages Page2 and Page4 visible. So, the Page 1 and Page3 are hidden as if they do not exist.
>>>>
>>>>How do I do it in the INIT of the form?
>>>>
>>>>TIA
>>>
>>>
>>>oPgFrm = CREATEOBJECT("Pageframe")
>>>oPgFrm.PageCount  =4
>>>oPgFrm.RemoveObject("Page3")
>>>
>>
>>Could you please clarify why you need the CREATEOBJECT("Pageframe")?
>>
>>The PageFrame (in my case) already created at design time. So, when I run the following code in the INIT of the form, I get error (object Page3 does not exist):
>>
>>oPgFrm = thisform.pageframe1
>>oPgFrm.RemoveObject("page3")
>>
>>
>>What am I missing?
>
>
>:-)
>Maybe the name of the page is NOT Page3?
>Try with:
>
>...
>oPgFrm.RemoveObject(oPgFrm.Pages(3).Name)
>
The problem was that I was setting the number of pages to smaller number before removing the object. I see now that I can set the page count to 4 and then remove pages 1 and 3 and it works.
Btw, the way I remove the page is as follows:
thisform.pageframe1.RemoveObject("page1")
thisform.pageframe1.RemoveObject("page3")
So, it works now.
Thank you!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform