Page 1 of 1

Tabpage Color under 254

Posted: Wed Mar 10, 2010 7:53 am
by edv-rudrich
Hi --
(IMPORTANT)

this change:
1084. DCTABPAGE .. COLOR now supports a code block for the foreground and
background colors.

causes extreme trouble in our tabpage coloring!
The xBase methods for setting the color do not work anymore -

And: (from our point of view...) it always DID support codeblocks..

Our code was:
@ 00,00 DCTABPAGE o4TabPage ;
CAPTION "ShF8 - Numbers" ;
PARENT oDlg ;
COLOR {||if(M->USER == "PCH", {GRA_CLR_BLACK, GRA_CLR_BACKGROUND}, {GRA_CLR_BLACK, GraMakeRGBColor({205,205,175})}) }

And we set Tabpage color depending on some vars in the code by:
// Changing Tabpage colors
IF nZNR_Status = 0
o4TabPage:SetColorBG(GRA_CLR_YELLOW)
ELSEIF nZNR_Status = 1
o4TabPage:SetColorBG(GRA_CLR_GREEN)
ELSEIF nZNR_Status = 2
o4TabPage:SetColorBG(GRA_CLR_RED)
ENDIF

This code does not affect the tabpages colors anymore..

Any help or workaround urgently needed!!

- Michael

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:15 am
by edv-rudrich
S T O P

this must have another reason...

I'm working on a test program..

Sorry

- Michael

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:16 am
by Tom
Hi, Michael.

The color with tabpages does not work with SL1 anymore if tabpages use visual styles (default). If Roger finds a color clause inside DCTABPAGE, he switches visual style off for this tabpage. This is what you should do - or add a "dummy" color clause to DCTABPAGE.

Tom

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:30 am
by edv-rudrich
Don't think so:

it must have todo with the change number 1084..

Before (Version 252) : If I set the color with :SetColorBG it 'keeps' the change..
Now: If I now set it with :setcolorBG, it changes back to the original color in the codeblock every time the
getlist is refreshed!!


Try this:
#INCLUDE "dcdialog.CH"

procedure appsys
return

procedure main
Local Getlist := {}
@ 00,00 DCTABPAGE o4TabPage ;
SIZE 100,20 ;
CAPTION "ShF8 - Z-Nummern" ;
COLOR {||{GRA_CLR_BLACK, GraMakeRGBColor({205,205,175})} }

@ 10,10 DCPUSHBUTTON CAPTION "Change Color" SIZE 12,1.2 ACTION {||o4TabPage:SetColorBG(GRA_CLR_RED), sleep(50), DC_GetRefresh(Getlist)} PARENT o4TabPage

DCREAD GUI FIT TITLE "TabTest" ADDBUTTONS to lOK



return

- MIchael

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:31 am
by rdonnay
Tom and Michael -

I made 2 changes to the tabpage color system in build 254.

1. Requested by Tom - switch off :visualStyle if a color clause exists.

2. Requested by Brian Wolfsohn - Support Code blocks for color (as documented).

The 2nd issue never did work. It only evaluated the code block when the tabpage was first created but then never after that.
I fixed that, but now that causes a problem for Michael.

The existence of the code block overrides any settings in your code because the code block is always evaluated on a DC_GetRefresh().

Michael - This should fix your problem (make sure your color clause is not a codeblock) :

Code: Select all

@ 00,00 DCTABPAGE o4TabPage ;
CAPTION "ShF8 - Numbers" ;
PARENT oDlg ;
COLOR if(M->USER == "PCH", {GRA_CLR_BLACK, GRA_CLR_BACKGROUND}, {GRA_CLR_BLACK, GraMakeRGBColor({205,205,175})}) 

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:44 am
by edv-rudrich
Roger -

thanks.. yes the second change is what causes my trouble..
The codeblock did only fire the first time when the tab was created..

I could fix it by using a variable for the background like:

if .. <something>
nBackColor := GRA_CLR_RED
else
nBackColor := GRA_CLR_GREEN
endif

and code:
DCTABPAGE bla lba
COLOR {||{GRA_CLR_BLACK, nBackColor} }

and simply change the color by changing the var nBackColor

if <something>
nBackColor := GRA_CLR_SCHWEINCHENROSA
elseif <something else>
nBackColor := GRA_CLR_FROSCHGRÜN
else
nBackColor := GRA_CLR_LASS_WIE_ES_IST
endif


- Michael

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 8:54 am
by rdonnay
Michael -

Yes, I was going to suggest that as another possible solution.
It looks like you already figured that out.

Roger

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 9:11 am
by edv-rudrich
Roger -

I now changed all the code that way -- was not a big deal...

Pls leave it as it is ;o))

Thks

- Michael

Re: Tabpage Color under 254

Posted: Wed Mar 10, 2010 9:18 am
by Tom
Hi, Michael.

If you post code to the forum, use the "CODE" button or code-tags to embed it. This is much easier to read:

Code: Select all

FUNCTION Michael(lEverythingWorks)
  IF lEverythingWorks
    FindAReasonToMoanAnyWay()
  ENDIF
RETURN TheRiverNile