Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hiding some pageframe.activepage under conditions
Message
From
07/03/2024 13:14:47
 
 
To
07/03/2024 07:07:02
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01687673
Message ID:
01687676
Views:
51
>>Hello community,
>>
>>On my form i have my main page "myform.pageframe1" with several adicional pages.
>>Also, they are 2 buttons, one for clients and another one for Suppliers.
>>
>>Suppose for client i have myform.pageframe1.activepage nº 1 , 2 , 3 and 4, and for suppliers i have myform.pageframe1.activepage nº 4,6,7.
>>What i need is when i click on button Client the activepages 1,2,3 and 4 are visible, but if i click on button Supplier thoses activepages become invisibles and put visible the pages 4,6 and 7 and the reverse also.
>>
>>I need to know how can do that.
>>
>
>Page doesn't have the Visible property, so you can't just hide these. Is it not sufficient to disable the pages that aren't relevant and activate the first relevant page?
>
>If that won't work for you, then maybe what you really need is two different pageframes, only one of which is visible at the same time. Since one page seems to apply in both cases, maybe save all the controls for that page into a container class and put that container onto a page in each pageframe.
>
>Tamar
>
>Hi Tamar,
>
>Thanks for your reply,
>
>You you mencioned : Is it not sufficient to disable the pages that aren't relevant and activate the first relevant page?
>could you give me an example please.

Wherever you were planning to make the pages invisible (presumably the Click method of the buttons), instead just set:

ThisForm.PageFrame1.Page1.Enabled = .F.

and so on for each page that should be disabled. For the ones that should be enabled in that case, you use similar code:

ThisForm.PageFrame1.Page5.Enabled = .T.

again, doing this for each relevant page. Then, I think you can bring the page you want to the top by setting the pageframe's ActivePage property:

ThisForm.PageFrame1.ActivePage = 4

>I don´t know how to add a second pageframe programmaticaly, have you a simple example about i can do that ?

If you want to go the other way, I don't see why you would add a second pageframe programmatically. Just design the form with two pageframes in the same place, and write the code so that at any given time, only one of them is visible. Pageframes have a Visible property, so you can just set that property to either .T. or .F. for each pageframe.

But if the goal is just to keep the user out of the pages that aren't relevant, the first approach of disabling them is a lot easier.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform