Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change tab colours (In a Class)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00411197
Message ID:
00412207
Views:
20
>with this
>>> .Setall('Forecolor',rgb(128,128,128),'Page')
>>> .pages(.ActivePage).Forecolor = rgb(255,0,0)
>>> return .ActivePage
>>>endwith
>
>Cetin, thanks for your sample code, which I hve used, and it works fine apart from one problem...
>
>In my page, I have 10 tabs. When I click on Page1 and Page 2, the correct tab changes colour. But if I click on tab 3, the fith tab changes colour. This also happens to other tabs..e.g if I click on tab 8, tab 10 changes colour.
>I think this is because , at some stage, I moved the order of tabs around.
>What eactly is the ActivePage proprty. In the help, it says it returns the NUMBER of the active page, but I cannot find a NUMBER property of the individual pages anywhere.
>
>Any ideas of how to fix this problem.
>Thanks for your help.
>Gerard


Gerard, the problem here that you probably have reordered your pages in the grid. NUMBER is not a property, it is an actual number of the active page in the display order.
ActivePage is based on the display order of the pages and equals the PageOrder of a page which is currently active. So, if you reordered pages after creation of the pageframe, and moved your Page10 to 8th place in display order, now .Pages(ActivePage) points to the wrong one.

To make it working right, you should loop through the .Pages() collection and find the page which is currently ActivePage
WITH THIS.
	.SETALL('Forecolor', RGB(128,128,128),'Page')
	FOR N = 1 TO .PAGECOUNT
		IF .ACTIVEPAGE = .PAGES(N).PAGEORDER
			.PAGES(N).FORECOLOR = RGB(255,0,0)
* do whatever else
			EXIT
		ENDIF
	ENDFOR
ENDWITH
Hope this helps.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform