Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabs on a pageframe 3

Status
Not open for further replies.

Jerim65

Technical User
Aug 8, 2010
99
AU
I use a pageframe as a 'wizard' type dialogue and up to now I have the tabs hidden.
Is it possible to show the tabs but make them inactive - I provide the navigational buttons in my app.

Each tab is a Step and I'd like to reinforce that with the users

Regards

Coldan
 
Hi Coldan,

Yes. You can do that by setting the Enabled property of the page to .F. If you also set the Tabs property of the pageframe to .T., that will make the tabs visible but inactive.

But I wonder if that's what you want. If you are providing an alternative means of navigating the wizard steps, I would have thought you'd want to keep the tabs invisible.

Maybe you mean that you want to skip over certain tabs when the user clicks on Next or Previous. In that case, you can't do it by setting properties. You will have to write the logic to activate the appropriate page as required.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
You can have all of the tab pages set Enabled except the individual ones that you want Not-Enabled.

While your situation may indeed be different, here is an example of how I have done it:
Code:
IF cUserType = "A"
   * --- Administrative UserType, Enable This Tab Page ---
   THISFORM.Pageframe1.ActivateOrder.ENABLED = .T.
ELSE
   * --- Non-Elevated UserType Does NOT Have Permission ---
   THISFORM.Pageframe1.ActivateOrder.ENABLED = .F.
ENDIF

NOTE - This is Form was not created with a Wizard since I suggest never to use those - too many unwanted and/or not understood functional attributes are 'inherited' and you don't really learn yourself how to create a Form.

Good Luck,
JRB-Bldr
 
Jrbbldr and Mike,

I have created the 'wizard' effect manually with my 9 page pageframe.

I will try the Enabled = .f. but obviously I will need to enable each when the users is directed to a particular page by my navigational buttons.

Thanks

Coldan
 
Mike,

I think the advantage is quite obvious, showing the disabled tabs users can see the steps of the process and still only use the one step currently enabled. Of course you could also put something on each page indicating what steps need to be done and highlighting the current step. But why not use the page tabs for that, you only set captions and have a good look already without much ado.

Bye, Olaf.
 
Olaf is correct as to why I want this.

However in trying to implement it - from Step1 I have a [Next] button which triggers a long sequence of processing required to get things ready for [Step2] and selection of a [Button] for the next step.

At the end of the [Next processing I have


thisform.mypageframe.ActivePage = 2

thisform.mypageframe.step2.Enabled = .t.


When I get to Step2 none of the controls are clickable?

Where am I wrong as I really want this style in my new version.

PS
I have tried the command given above by JRB in that sequence also

thisform.mypageframe.ActivateOrder.ENABLED = .T.

but I don't see the ActivateOrder method for a pageframe so I guess it means the way I have the code above is correct? Bur doesn't work.

Regards

Coldan


 
You didn't enter the line of code exactly as I wrote it, did you?

"but I don't see the ActivateOrder method for a pageframe"

ActivateOrder is the name of the specific PageFrame Tab 'page' that I used in the example.

Obviously you need to modify the line to meet your own Form's criteria such as PageFrame tab page names, etc.

If so then
thisform.mypageframe.ActivateOrder.ENABLED = .T.
should become something like...
thisform.mypageframe.ThisTabPageName.ENABLED = .T.

Good Luck,
JRB-Bldr
 
Coldan,

Assuming you have not changed the default names of any of the pages, and assuming you have not changed any of the pages' PageOrder property, then this code should do what you want:

Code:
thisform.mypageframe.Page2.Enabled = .T.
thisform.mypageframe.ActivePage = 2

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Actually in my more recent suggestion above
thisform.mypageframe.ThisTabPageName.ENABLED = .T.
should become (assuming that you use the default object names)
thisform.Pageframe1.Page2.ENABLED = .T.

NOTE - you should substitute your own form object names into the above.
Pageframe1 - should be replaced with the Name of the PageFrame in your own form.
Page2 - should be replaced with the Name of the specific tab Page that you want to affect on your own form.

The thisform.mypageframe.ActivePage = 2 will force the form's focus onto the newly activated page (in this example's case Tab Page #2).
NOTE - again substitute your own form's Pageframe name for the mypageframe

Good Luck,
JRB-Bldr
 
No matter how you named the pages of your pageframe you can always work with the Pages() collection. The following code is enabling and activating Page 2, disabling Page 1, no matter how they are named:

Code:
nPreviousPage = 1
nNextPage = 2
With Thisform.pageframe1
   .Pages(nNextPage).Enabled=.T.
   .ActivePage = nNextPage
   .Pages(nPreviousPage).Enabled=.F.
Endwith

The only other thing to consider is, that Pages(N) visually is not necessarily always the Nth page. As you can change page order, pages(2) can also become the first page for example. But as long as you did not change the page orders, this will work and you only need to change the values 1 and 2 to the number of the current and the next step from step to step.

Bye, Olaf.
 
Olf,

Thank you for your elegant solution.

I found that both with your code and what I had before I needed

With Thisform.pageframe1
.pageframe1=.t. <<<<<<<<<<<<<<<<<<
.Pages(nNextPage).Enabled=.T.

Coldan
 
Coldan,

surely not, the line you point to cannot work.
With thisform.pageframe1 should be the name of the pageframe, you need to adjust this, if you renamed the pageframe.

Within the pageframe subobjects are pages and even if you named some page "pageframe1" to have

Thisform.pageframe1.pageframe1 as a page, you can't set that to .T., as a page is an object, an object can't be written to, neither .T. nor any other value.

And if .pageframe1 is a property you added to pageframe1, then why and what would it stand for?

Bye, Olaf.

 
Olaf,

Maybe my 'early' VFP knowledge is not vast but this is the code I meant. Sorry to have got it wrong.

nPreviousPage = 1
nNextPage = 2
With Thisform.pageframe1
.Enabled=.T. <<<<<<<<<<<<<<<<<<<<<
.Pages(nNextPage).Enabled=.T.
.ActivePage = nNextPage
.Pages(nPreviousPage).Enabled=.F.
Endwith

I have to add this line to my buttons to access the buttons on the next page.

Regards

Coldan
 
Thanks Tamar,

I'll have a look later.

Code:
With Thisform.pageframe1
  .Enabled=.T.
...
Endwith

You'd only need this once and could also set the pageframe itself enabled in the form designer, this is not something you need to set each time, you also don't need to set it .F. in the first place, as that disables the whole pageframe, what you need .F. in the first place is each page.

eg you need thisform.pageframe1.setall("Enabled",.F.,"Page") in the form init, no more, no less. Don't set pageframe.enabled .F.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top