How to hide a page?

Topics related to the Krypton Navigator.

Moderators: Phil Wright, Chris Porter

How to hide a page?

Postby Tommy Carlier » Fri Jun 01, 2007 8:20 pm

How can I hide a KryptonPage (and the attached button or tab)? I've tried setting Visible to false (in code), but it doesn't work if the Visible property is already false (because the page is not selected).
I'm working on an application where the user logs on, and depending on the type of user, certain pages (and their button/tab) should be hidden.
Tommy Carlier
 
Posts: 102
Joined: Sat May 06, 2006 9:51 pm
Location: Belgium

Postby Tommy Carlier » Fri Jun 01, 2007 8:24 pm

I managed to temporarily get the desired effect by first setting Visible to true and then to false.
EDIT: apparently, this trick only works after the form has been shown (works in the OnShown method of the form, but not before that.)
Tommy Carlier
 
Posts: 102
Joined: Sat May 06, 2006 9:51 pm
Location: Belgium

Postby Phil Wright » Fri Jun 01, 2007 9:56 pm

Did you try using the KryptonPage.Hide() method instead? Not sure it will make any difference but worth a try.
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia

Postby Tommy Carlier » Sat Jun 02, 2007 3:39 am

I'll try it out Monday.
Tommy Carlier
 
Posts: 102
Joined: Sat May 06, 2006 9:51 pm
Location: Belgium

Postby Tommy Carlier » Mon Jun 04, 2007 7:40 pm

KryptonPage.Hide() has the same effect as setting KryptonPage.Visible to false.
Tommy Carlier
 
Posts: 102
Joined: Sat May 06, 2006 9:51 pm
Location: Belgium

Postby Phil Wright » Tue Jun 05, 2007 6:28 pm

This is odd. The actual KryptonPage is not hidden when it is not the selected page. Instead it is merely positioned off the visible area of the control so you cannot see it. Hence it should return True for KryptonPage.Visible at runtime even when it is not visible.

I wonder if you scenario is occuring because you are trying to access the visible property before the control has been fully created or displayed for the first time? Do you have a sample that demonstrates the issue?
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia

Postby Tommy Carlier » Tue Jun 05, 2007 8:26 pm

It's very easy to reproduce:
- create a new Windows Application
- drop a KryptonNavigator on the form (it will already have 2 pages)
- in the constructor, after InitializeComponent(), put this line: kryptonPage2.Visible = false;
- run

The second tab is still visible and if you click it you even get an exception 'Cannot select a page that is not visible'
Tommy Carlier
 
Posts: 102
Joined: Sat May 06, 2006 9:51 pm
Location: Belgium

Postby thols » Tue May 13, 2008 6:29 pm

Same problem here. Is there a fix for it?
thols
 
Posts: 1
Joined: Mon Apr 14, 2008 6:30 pm

Postby Phil Wright » Tue May 13, 2008 7:35 pm

Added to the bug list. Thanks.
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia

Postby Phil Wright » Mon May 26, 2008 7:27 pm

You need to set the property in the Load event of the Form and not in the constructor. In general you should not be changing visual controls in the constructor but instead in the Load event because the controls have not actually had their windows handles created until that event is fired.
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia

Re:

Postby Torrwin » Wed Aug 27, 2008 2:00 am

Tommy Carlier wrote:The second tab is still visible and if you click it you even get an exception 'Cannot select a page that is not visible'


I'm having the exact same problem. Is there a workaround yet?
Torrwin
 
Posts: 31
Joined: Fri Jun 20, 2008 8:55 am

Re: How to hide a page?

Postby aspatz » Fri Sep 05, 2008 12:19 am

hallo,

i have the same problem with the Navigator:

- i have a MainNavigator with MainPage1, MainPage2, ...
- and a DetailNavigator with DetailPage1, DetailPage2, DetailPage3, DetailPage4.

-> Case1: MainPage1 uses DetailPage1, DetailPage2, DetailPage3
-> Case2: MainPage2 uses DetailPage1, DetailPage3, DetailPage4

i want to make in Case1 the DetailPage4 and in Case2 DetailPage3 invisible.
I think this is a common szenario. How can i do it.
When will a service release be available.

regards Arnold
aspatz
 
Posts: 19
Joined: Tue Feb 19, 2008 6:51 pm

Re: How to hide a page?

Postby vesuvius » Fri Sep 05, 2008 1:58 am

Phil this is NOT a bug.

I have the following navigator on a form

Image


If I use kryptonPage2.Visible = false; or kryptonPage2.Hide(); in the Form_Load the This Works

If you use both these commands in the forms contructor the they do not work.

aspatz there is no problem here, and you need to figure out how to show and hide your navigators. I have a similar application doing what you want and it works.
vesuvius
 
Posts: 582
Joined: Thu Aug 16, 2007 8:38 pm
Location: Yorkshire, England

Re: How to hide a page?

Postby Torrwin » Fri Sep 05, 2008 2:02 am

Vesuvius,

Are you just addressing aspatz's post, or all four of ours?
Torrwin
 
Posts: 31
Joined: Fri Jun 20, 2008 8:55 am

Re: How to hide a page?

Postby vesuvius » Fri Sep 05, 2008 2:47 am

I am addressing all of them. The mistake people have made is using the krypton logis in the forms contructor and not in the form load.

If you have any problems, just post in this thread and I'll do what I can to help. I can even do a screencast to prove that this works.
vesuvius
 
Posts: 582
Joined: Thu Aug 16, 2007 8:38 pm
Location: Yorkshire, England

Re: How to hide a page?

Postby Torrwin » Fri Sep 05, 2008 5:15 am

My visible properties are toggled at runtime, not in the constructor.

I'm working on sending you a sample application which reproduces the problem.
Torrwin
 
Posts: 31
Joined: Fri Jun 20, 2008 8:55 am

Re: How to hide a page?

Postby aspatz » Sat Sep 06, 2008 4:43 am

hallo Vesuvio,

...it is not like you say.
I have to handle the Navigator Page visibility at runtime not in the constructor or load.
And than it does not work. The only way to made Pages invisible is to remove them, if you want them to show again you have to add them. I will now add an dictionary to the navigator to cache removed pages.

Arnold
aspatz
 
Posts: 19
Joined: Tue Feb 19, 2008 6:51 pm

Re: How to hide a page?

Postby aspatz » Sat Sep 06, 2008 5:46 am

hallo Vesuvius and the others,
I have to excus me.

The TabPages Visibility works:

NavigatorXYZ.Pages["NameOfThePage"].Visible = false;

Arnold
aspatz
 
Posts: 19
Joined: Tue Feb 19, 2008 6:51 pm

Re: How to hide a page?

Postby Torrwin » Sat Sep 27, 2008 4:48 am

I was unable to scale down my application enough (while still reproducing the problem) to send you a sample app.

However, installing 3.0.0 seems to have fixed the issue. Thanks for whatever you did! :)
Torrwin
 
Posts: 31
Joined: Fri Jun 20, 2008 8:55 am


Return to Krypton Navigator

Who is online

Users browsing this forum: No registered users and 1 guest

cron