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

PageFrame Simple Question

Status
Not open for further replies.

crewchiefpro6

Programmer
Mar 22, 2005
204
US
I have always used this code in the activate of any pageframe Active page:
THIS.FONTBOLD = .T.
THIS.FONTNAME = "Tahoma"
THIS.FONTSIZE = 10

and this in the deactivate of the page:
THIS.FONTBOLD = .f.
THIS.FONTNAME = "Tahoma"
THIS.FONTSIZE = 9

I try to make the page jump out at them just a bit on entry and return on exit to the previous settings.

My question is how can I make this into a method for each so I can change one setting that affects all of them. I have tried to create a method with the same info in them but THIS is no longer the pageframe page. If I can do this then I can create a class but first I need it to work on the test form.

Don


Don Higgins
 
I assume you're wanting to put a common method into the PageFrame itself. You could refer to the page selected as This.Pages[This.ActivePage] or you could pass This as a parameter from the page's Activate.

Geoff Franklin
 
Don,

I've subclassed the PageFrame object by adding a "tab_refresh" method that I call in each 'Page.Activate'.

Here's the code:
Code:
PROCEDURE tab_refresh
LOCAL lcTmpPage, x
FOR x = 1 to this.pagecount
        *- Occasionally I programatically destroy a page.  Make sure it still exists before trying to change it's FONTBOLD property.
	lcTmpPage = 'this.pages(' + ALLTRIM(STR(x)) + ')'
	IF VARTYPE(&lcTmpPage.) = 'O'
		this.pages(x).fontbold = (this.activepage = x)
	ENDIF
ENDFOR
ENDPROC

Code:
PROCEDURE Page1.Activate
	this.parent.tab_refresh()
ENDPROC

Steve
 

Steve,

I can see how your code would solve Don's problem. However, you presumably wrote this originally to refresh the pages on a PageActivate?

Do you in fact refresh all the pages in the pageframe each time a page is activated? It would seem more efficient just to refresh the newly-activated page, given that refeshing a non-visible page would take time, even though the user won't see the refreshed data.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Here is what I did last night before I saw the responsens. Turns out the Geoff and I came up with similar answers.

I called the Method with a parameter as he suggested.
Code:
***********************************************************************
*** Changed By.: Donald J. Higgins on 19 December 2005
*** Reason.....: used to change all font size, bold, etc on the page that is now ACTIVATED
***********************************************************************
thisform.setActivefont(Thisform.pageframe1.rollPaymentPage.pageframeRollBack.FinanceRollBack)
***********************************************************************

Code In the method:
Code:
LPARAMETERS WhatPageAreYouOn
WhatPageAreYouOn.FONTBOLD = .T.
WhatPageAreYouOn.FONTNAME = "Tahoma"
WhatPageAreYouOn.FONTSIZE = 10

In the Deactive code I reverse the process with the same code, just different fontbold and size.

Thanks for the great ideas.



Don Higgins
 
Mike,

Actually my code was designed to just toggle the Bold setting of the tab so as the user tabbed thru the pages only the tab of the active page would be shown as bold.

In practice I've usually put only one other line of code in the page activate method - this.somecontrol.setfocus() - to get focus to the first item (textbox, combo, option button, etc.) that I wanted the user to be on for that page.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top