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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Programmatically Select Page in pageframe

Status
Not open for further replies.

RafPh123

MIS
Oct 19, 2011
2
PH
Hi,

is it possible to select Pages of a Pageframe programmatically?

what i am trying to do is, upon start the Page Frame with 3 pages is disabled, and the main form has 3 command buttons.

whenever you click any command button, the command button will enabled the Page Frame and should automatically set the active page based on the command button.

lets say command1 enables Page Frame and sets focus on Page1
Command2 enabled Page Frame and sets focus on Page 2
and so on.

i am using VFP 9, and have tried PageFrame.activepage = 2 didnt work, still active page is 1

i tried pageframe.page2.setfocus() didnt work..

i was wondering if automatic selection is possible
 
Setting ActivePage is the right thing to do. Refresh the form to see the effect.

Also see the sample code provided in the VFP9 help on the ActivePage Proeprty. It does chang pages programmatically via "Next" and "Previous" buttons.

Bye, Olaf.
 
You are right that you need to set the pageframe's ActivePage. That should work.

If it isn't working for you, it's probably because the page in question is disabled. Make sure you set the page's Enabled property to .T. before you change the ActivePage.

By the way, SetFocus has got nothing to do with this. You can set focus to a control on a page independently of which page is active.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike is right the page has to be enabled. Maybe enabling the pageframe does leave the single pages disabled, but I'm not sure. Instead of disabling the pageframe you could set it's Tabs=.f., so it will not have tabs and then only the buttons will enable navigating the pages.

Bye, Olaf.
 
Thanks Mike, Olaf.

refresh did work, cant remember why i failed to put that part in the form.

also did try to remove the tabs and see which one would be pleasing to the eyes.

worked better with tabs off.
 
Glad to hear it works.

I also like to switch the tabs off, and use either command buttons, an option group, or even outsize labels to activate the pages. You can get some quite pleasing effects that way, as you have found.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I also used tabs off with a secondary pageframe, of which I only used tabs. I resized it, so you only see it's tabs. That gives you the chance to only add the tabs the user is able to select and allows to keep "hidden" pages. Page activate events simply set the active page of the pageframe without tabs and so indirectly control that pageframe.

This way, the two pageframes look like a single one from the user perspective, but without disabled tabs being visible to the user.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top