FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Browse colour corruptions with bitmaps
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Browse colour corruptions with bitmaps
Posted: Wed Jan 14, 2009 03:17 PM
Hi,

Since upgrading to 8.12 i've noticed that the colours of bitmaps in a browse (twbrowse?) are corrupted:



The first 2 columns should be the same colour as the rest of the line - also if you scroll down the list the highlight bar turns the bitmap white.

Any ideas how to fix this?

Many Thanks

Pete
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 11:56 AM

Pete,

Are you using a codeblock to set the browse colors or just fixed RGB Colors (numeric value) ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 12:07 PM
I'm using a code block.

oBrw:nClrpane       := { || SetBack()  }
oBrw:nClrText       := { || SetFore()  }
oBrw:nClrforefocus  := { || SetFBack() }
oBrw:nClrbackfocus  := { || SetFFore() }

STATIC FUNCTION SetBack
	LOCAL RetCol := 0
	ScedColInit()
	IF SELECT("SCHEDULE") <> 0 .AND. ASCAN(SchedArr,SCHEDULE->(RECNO())) <> 0
		RetCol := mGrpBack
	ELSEIF ORDSCED->OR_FROMDAT < m_scdate
		RetCol := mOverBack
	ELSEIF !EMPTY(ORDSCED->OR_VEHICLE)
		RetCol := mAlocBack
	ELSE
		RetCol := mNormBack
	ENDIF
RETURN RetCol

STATIC FUNCTION SetFore
	LOCAL RetCol := 0
	IF SELECT("SCHEDULE") <> 0 .AND. ASCAN(SchedArr,SCHEDULE->(RECNO())) <> 0
		RetCol := mGrpFore
	ELSEIF ORDSCED->OR_FROMDAT < m_scdate
		RetCol := mOverFore
	ELSEIF !EMPTY(ORDSCED->OR_VEHICLE)
		RetCol := mAlocFore
	ELSE
		RetCol := mNormFore
	ENDIF
RETURN RetCol			   

STATIC FUNCTION SetFBack
	LOCAL RetCol := 0
	IF SELECT("SCHEDULE") <> 0 .AND. ASCAN(SchedArr,SCHEDULE->(RECNO())) <> 0
		RetCol := mGrpFocB
	ELSEIF ORDSCED->OR_FROMDAT < m_scdate
		RetCol := mOverFocB
	ELSEIF !EMPTY(ORDSCED->OR_VEHICLE)
		RetCol := mAlocFocB
	ELSE
		RetCol := mNormFocB
	ENDIF
RETURN RetCol			   

STATIC FUNCTION SetFFore
	LOCAL RetCol := 0
	IF SELECT("SCHEDULE") <> 0 .AND. ASCAN(SchedArr,SCHEDULE->(RECNO())) <> 0
		RetCol := mGrpFocF
	ELSEIF ORDSCED->OR_FROMDAT < m_scdate
		RetCol := mOverFocF
	ELSEIF !EMPTY(ORDSCED->OR_VEHICLE)
		RetCol := mAlocFocF
	ELSE
		RetCol := mNormFocF
	ENDIF
RETURN RetCol
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 12:27 PM

Pete,

What FWH build were you using previously to 8.12 ?

The simplest way should be to compare wbrowse.prg from both versions and see what changes may be affecting your code.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 12:29 PM

Pete,

I just reread your first post and noticed that you were talking about the bitmaps! ops, my mistake :oops:

Please post here some of the bitmaps that you are using. You can use www.imageshack.us to upload the images and post here the urls.
Thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 01:04 PM
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 01:52 PM
Pete,

Please change the background color of your bitmaps to a color not used in the image, like this:

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 02:15 PM

Just tried it and no difference i'm afraid - also i noticed that the highlight bar doesnt highlight the bitmap columns

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 02:38 PM
Antonio,

Just linked in my previous version of wbrowse.prg (7.12) and it works fine - i have done a file compare between the two files and i think the problem is in the function wBrwLine

If i comment the nRowpos line as detailed below, this fixes the problem

static function wBrwLine( hWnd, hDC, nRowPos, aValues, aColSizes,;
                          nColPos, nClrText, nClrPane,;
                          hFont, lTree, aJustify, nPressed, nLineStyle,;
                          nColAct, lFocused, oVScroll, bLogicLen, nClrTxt, nClrBack )
   local nTxtHeight, hOldFont
   local nColStart  := -1
   local nWidth     := WndWidth( hWnd ) - If( oVScroll != nil .and. ;
                       Eval( bLogicLen ) > 1,;
                       GetSysMetrics( SM_CYHSCROLL ) + 3, 0 )
   local nRow := nRowPos, nTop, nBottom, nLeft, nRight, n
   local lReleaseDC := .f.
   local hPen, hOld, hBrush

   DEFAULT lTree := .f.

   if Empty( hDC )
      hDC = GetDC( hWnd )
      lReleaseDC = .t.
   endif

   hOldFont   = SelectObject( hDC, hFont )
   nTxtHeight = GetTextHeight( hWnd, hDC ) + 1

   nTop    = nTxtHeight * nRow
   nBottom = nTop + nTxtHeight - 1

   SetTextColor( hDC, If( ValType( nClrText ) == "B",;
                 nClrText := Eval( nClrText ), nClrText ) )
   //if nRowPos == 0              
      SetBkColor( hDC, If( ValType( nClrPane ) == "B",;
                  nClrPane := Eval( nClrPane ), nClrPane ) )
   //endif


However there is one more difference between the two versions:

if ValType( aValues[ n ] ) == "N"
         hBrush = CreateSolidBrush( If( nColAct != nil, nClrBack, GetBkColor( hDC ) ) )
         hOld   = SelectObject( hDC, hBrush )
         FillRect( hDC, { nTop, nLeft, nBottom, nRight + If( ( nLineStyle == ;
                   LINES_NONE .or. nLineStyle == LINES_H_GRAY .or. nLineStyle == ;
                   LINES_H_BLACK ) .and. nRowPos != 0, 2, 0 ) }, hBrush )
         DrawMasked( hDC, aValues[ n ], nTop, nLeft + 0 )
         SelectObject( hDC, hOld )
         DeleteObject( hBrush )
      else
         if nColAct != nil .and. n == nColAct
            SetTextColor( hDC, nClrText )
            SetBkColor( hDC, nClrPane )
         else
            if nRowPos != 0
               SetTextColor( hDC, If( nColAct != nil, If( ValType( nClrTxt ) == "B",;
                             Eval( nClrTxt, n ), nClrTxt ),;
                             If( ValType( nClrText ) == "B", Eval( nClrText, n ), nClrText ) ) )          <-----This is new in 8.12 over 7.12
               SetBkColor( hDC, If( nColAct != nil, If( ValType( nClrBack ) == "B",;
                             Eval( nClrBack, n ), nClrBack ),;
                             If( ValType( nClrPane ) == "B", Eval( nClrPane, n ), nClrPane ) ) )         <-----This is new in 8.12 over 7.12
            endif
         endif
         if ! lTree
            if nRowPos == 0 .and. ( IsAppThemed() .and. IsThemeActive() )     <--- The .and. isthemeactive() is new in 8.12 over 7.12
               DrawHeader( hWnd, hDC, nTop - 1, nLeft, nBottom, nRight, AnsiToOem( aValues[ n ] ) )
            else
            if aJustify != nil .and. aJustify[ n ]
               SetTextAlign( hDC, TA_RIGHT )
               ExtTextOut( hDC, nTop, nRight - 2,;
                           { nTop, nLeft, nBottom, nRight + If( (nLineStyle == ;
                           LINES_NONE .or. nLineStyle == LINES_H_GRAY .or. ;
                        nLineStyle == LINES_H_BLACK ) .and. nRowPos != 0, 2, 0 ) },; //socs + If((nLineStyle == LINES_NONE .OR. nLineStyle == LINES_H_GRAY .OR. nLineStyle == LINES_H_BLACK) .AND. nRowPos#0 ,2,0),;
                           cValToChar( aValues[ n ] ) )
            else
               SetTextAlign( hDC, TA_LEFT )
               ExtTextOut( hDC, nTop, nLeft + 2,;
                           { nTop, nLeft, nBottom, nRight + If( ( nLineStyle == ;
                           LINES_NONE .or. nLineStyle == LINES_H_GRAY .or. ;
                        nLineStyle == LINES_H_BLACK ) .and. nRowPos != 0, 2, 0 ) },;
                           cValToChar( aValues[ n ] ) )
            endif
            endif
         else
            DrawText( hDC, cValToChar( aValues[ n ] ),;
                      { nTop, nLeft + 4, nBottom, nRight } )
         endif
      endif


My knowledge of modifying this code is limited so what harm would it be to comment out the first line or does it need modifying?
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 02:50 PM
Pete,

You are right, its a bug in Class TWBrowse. Just remove these two lines and it should work fine:
static function wBrwLine( hWnd, hDC, nRowPos, aValues, aColSizes,;
...
   SetTextColor( hDC, If( ValType( nClrText ) == "B",;
                 nClrText := Eval( nClrText ), nClrText ) )
   //if nRowPos == 0              
      SetBkColor( hDC, If( ValType( nClrPane ) == "B",;
                  nClrPane := Eval( nClrPane ), nClrPane ) )
   //endif

Here it is working fine with those changes.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 03:03 PM

Thanks for your response Antonio - will this be fixed in the next release (9.01)?

Many Thanks

Pete

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Browse colour corruptions with bitmaps
Posted: Thu Jan 15, 2009 03:08 PM

Pete,

Yes, we have already included it for the next 9.01 build

Thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion