FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 10:36 AM
i MADE A GRID ( XBROWSE)
i PUT A BACKGROUND


FOR EACH XBROWSE COLUMN i USE BITMAPS AS YOU SEE ON MY PICTURE
THE BITMPAS ARE NOT TRAPSRENT ON XBROWSE BACKGROUND
: WHY ?

I TRY ALSO TO REFILL EACH BITMAPS WITH 255,0,255 COLOR

ANY IDEA ?
Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 01:11 PM

Hello Silvio,

some month ago, I noticed this and I have done some tests.

FWH 8.09 Xbrowse-Tests : Colors, Bitmaps and backgrounds.

viewforum.php?f=3start=650

Because the problem couldn't be solved to 100 %, there is still the old xBrowse-source delivered.
This problem is not solved for the moment to paint transparent BMP's on brushes.

Regards
Uwe :lol:

&

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 02:29 PM
Hello Silvio...

please try this change into class

1.- New define data
#define SRCPAINT 0x00EE0086

2.- New data Class CLASS TXBrwColumn
DATA lBmpTransparent AS LOGICAL

3.- add this line into "METHOD NEW CLASS TXBrwColumn"
::lBmpTransparent := .t.

4.- Change this line into "METHOD PAINDATA CLASS TXBrwColumn"

         PalBmpDraw( hDC, nBmpRow, nBmpCol,;
                     aBitmap[ BITMAP_HANDLE ],;
                     aBitmap[ BITMAP_PALETTE ],;
                     aBitmap[ BITMAP_WIDTH ],;
                     aBitmap[ BITMAP_HEIGHT ];
                     ,, .t., aColors[ 2 ] )

for this lines
        PalBmpDraw( hDC, nBmpRow, nBmpCol,;
                     aBitmap[ BITMAP_HANDLE ],;
                     aBitmap[ BITMAP_PALETTE ],;
                     aBitmap[ BITMAP_WIDTH ],;
                     aBitmap[ BITMAP_HEIGHT ];
                     ,if(::oBrw:lBrushed,SRCPAINT,), ::lBmpTransparent, aColors[ 2 ] )


point 2-3 are personal change
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 02:38 PM
I change the xbrowse class
the bitmaps are not transparent

Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 03:19 PM
Silvio,

I tested as well with a brush :



There is no difference.
You have also adjust the row-height, like You can see in the screenshot.
There is still something wrong. The row-height is calculated with the 1. image.



You must get the size of the image with the greatest Height and adjust the Row-Height !!
----------------------------------------------------------------------------------------------------------
IF oBrw:nRowHeight < nBMPHight
    oBrw:nRowHeight := nBMPHight + 4
ENDIF


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 06:48 PM

I think that the solution is to call TransBmp() instead of PalBmpDraw()

Try this:
oBrw:lTransparent = .T.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 08:12 PM
sorry silvio... my mistake

i did test with xbrowse new feature "cBmpAdjBrush"... only work with that :-)
and did aply simple imagen technical...


aBrw[ 1 ]:= txbrowse():new( oFolder:aDialogs[ 1 ] )
aBrw[ 1 ]:nRowHeight := 30
aBrw[ 1 ]:nColDividerStyle 	:= LINESTYLE_BLACK
aBrw[ 1 ]:nRowDividerStyle 	:= LINESTYLE_BLACK
aBrw[ 1 ]:SetArray( aArray1 )
aBrw[ 1 ]:cBmpAdjBrush 			:= "frog.bmp"
aBrw[ 1 ]:SetBackGround( "frog.bmp" )
aBrw[ 1 ]:CreateFromCode()
aBrw[ 1 ]:bClrStd 					:= {|| {CLR_WHITE, CLR_BLACK} }
aBrw[ 1 ]:nTop 							:= 0
aBrw[ 1 ]:nLeft							:= 0
aBrw[ 1 ]:nBottom						:= 120
aBrw[ 1 ]:nRight						:= 160
aBrw[ 1 ]:aCols[ 1 ]:addbmpfile( "arrow.bmp" )
aBrw[ 1 ]:aCols[ 1 ]:addbmpfile( "bottom.bmp" )
aBrw[ 1 ]:aCols[ 1 ]:bBmpData := {|| if ( aBrw[ 1 ]:nArrayAt() % 2 == 0,2,1) }


this line is very import , is necesary param #2 are BLACK
aBrw[ 1 ]:bClrStd := {|| {CLR_WHITE, CLR_BLACK} }

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Thu Jan 22, 2009 09:16 PM
Hello Daniel,

I tested Your changes, but my BMP's are looking funny.
There is Transparency now, but the colors are strange looking.



If You change the Row-selector / position, the Image-color is not restored.



// Image
// --------
IF  nArrayPos = 9
   // To receive the Row-Height ( from biggest BMP )
   // --------------------------------------------------------
   DEFINE IMAGE oImage1 RESOURCE "Help" 
   oBrw5:nRowHeight := oImage1:nWidth() + 4
   oImage1:End()
   // --------------
   oBrw5:cBmpAdjBrush := "FANTASY1.BMP" 
   oBrw5:SetBackGround( "FANTASY1.BMP" )
*  aeval( oBrw5:aCols, { |o|o:lColTransparent := .t. } ) 
   oBrw5:aCols[ 2 ]:bClrStd := {|| {CLR_WHITE, CLR_BLACK} }
   oBrw5:aCols[ 2 ]:AddResource("Help")
   oBrw5:aCols[ 2 ]:AddResource("Calendar")
*   oBrw5[ 2 ]:aCols[ 1 ]:addbmpfile( "arrow.bmp" )
*   oBrw5[ 2 ]:aCols[ 1 ]:addbmpfile( "bottom.bmp" )
   oBrw5:aCols[2]:bBmpData := {|| if ( oBrw5:nArrayAt() % 2 == 0,2,1) }
   oBrw5:Refresh()
ENDIF


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Fri Jan 23, 2009 02:28 AM
Master Antonio you catched solution very very near...
when you do use BRUSH automaticly set .t. ::lTransparet

please remove last change
again... change over class

original line...( with ::lBmpTransparent DATA :-) )
         PalBmpDraw( hDC, nBmpRow, nBmpCol,;
                     aBitmap[ BITMAP_HANDLE ],;
                     aBitmap[ BITMAP_PALETTE ],;
                     aBitmap[ BITMAP_WIDTH ],;
                     aBitmap[ BITMAP_HEIGHT ];
                     ,, ::lBmpTransparent, aColors[ 2 ] )


add IF sentence with new lines
	IF ::oBrw:lTransparent
         nOldColor := SetBkColor( hDC, nRGB( 255, 255, 255 ) )
         TransBmp( aBitmap[ BITMAP_HANDLE ], aBitmap[ BITMAP_WIDTH ], aBitmap[ BITMAP_HEIGHT ],;
                   aBitmap[ BITMAP_ZEROCLR ], hDC, nBmpCol, nBmpRow, aBitmap[ BITMAP_WIDTH ], ;
                   aBitmap[ BITMAP_HEIGHT ] )
         SetBkColor( hDC, nOldColor )
    else
         PalBmpDraw( hDC, nBmpRow, nBmpCol,;
                     aBitmap[ BITMAP_HANDLE ],;
                     aBitmap[ BITMAP_PALETTE ],;
                     aBitmap[ BITMAP_WIDTH ],;
                     aBitmap[ BITMAP_HEIGHT ];
                     ,, ::lBmpTransparent, aColors[ 2 ] )
	endif


now see ok with or without cBmpAdjBrush...

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Fri Jan 23, 2009 08:53 AM
Now the bitmaps are transparent

When I click on a row of the xbrowse I cannot see the bitmaps
this is my configuration sample

oApp():oDlg:NewGrid( nSplit )
oApp():oGrid:nMarqueeStyle       := MARQSTYLE_HIGHLROWMS    // per la multi selezione
oApp():oGrid:nColDividerStyle    := LINESTYLE_FORECOLOR
oApp():oGrid:lColDividerComplete := .t.
oApp():oGrid:lRecordSelector := .F.

and one column :

                                         oCol:= oApp():oGrid:AddCol()
                                          oCol:AddResource("sort1")
                                          oCol:AddResource("sort2")
                                          oCol:cHeader  := "Grado"
                                          oCol:nHeadBmpNo    := if( (oDCli)->( ORDNUMBER() ) == 7, 1, 2)
                                          oCol:nHeadBmpAlign := AL_RIGHT
                                          oCol:bLClickHeader :={ ||(Sel_Index(6,oDCli) , oApp():oTab:nOption:=6,oApp():oTab:refresh()) }
                                          oCol:AddResource("GRADO1")
                                          oCol:AddResource("GRADO2")
                                          oCol:AddResource("GRADO3")
                                          oCol:AddResource("GRADO4")
                                          oCol:AddResource("GRADO5")
                                          oCol:AddResource("GRADO6")
                                          oCol:AddResource("GRADO7")
                                          oCol:AddResource("GRADO8")
                                          oCol:AddResource("GRADO0")
                                          oCol:bStrData := { || (oDCli)->GRADO}
                                          oCol:bBmpData := { || (oDCli)->GRADO + 2}
                                          oCol:nWidth   :=40






and then at the end


 oApp():oGrid:nFreeze :=3
 oApp():oGrid:SetRDD()
 oApp():oGrid:bClrStd := { || Colores(oDCli) }
 oApp():oGrid:SetBackGround( ".\bitmaps\pclogog.BMP" )
 oApp():oGrid:CreateFromCode()
 oApp():oGrid:bChange    :={ || (RefreshCont(oCont,oDCli)) }
 oApp():oGrid:bRClicked := {|nRow,nCol| Disp_Men(oApp():oDlg,nRow,nCol,oDCli) }
 oApp():oGrid:bKeyDown   :={|nKey| Val_nKey(nKey,oApp():oDlg)}
 oApp():oGrid:bSeek      :={|c| DbSeek( Upper( c ) ) }
 oApp():oGrid:nRowHeight  :=40
 oApp():oGrid:nHeaderHeight  := 36
 oApp():oGrid:RestoreState( cState )


.......

STATIC FUNCTION Colores(cdbf)
LOCAL aCol:={}
IF  (cdbf)->(Ordkeyno()) % 2 == 0
aCol:={CLR_BLACK, RGB(193,221,255) }
ELSE
aCol:={CLR_BLACK, RGB(221,245,255) }
ENDIF
RETURN (aCol)


when I click on a row at xbrowse I see a row blu with data text NO bitmaps: ( the other rows have transparent bitmaps)





the problem is wen I use this command
oApp():nMarqueeStyle := MARQSTYLE_HIGHLROWMS
I need it for the multiselection and to browse all data
Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Fri Jan 23, 2009 11:23 AM
Daniel,

I have the same result like Silvio.
The dispay of the images is OK now, but the row-selection is not transparent anymore
and doesn't show the image.



Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Fri Jan 23, 2009 04:57 PM

Any Idea ? :)

Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Fri Jan 23, 2009 06:42 PM

i'm working...

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Sat Jan 24, 2009 10:09 AM
Hello Daniel,

The transparent BMP-painting on < BRUSHES > seems to be solved as well with Your changes.
There was no < transparent > at Brushes in the last FWH-Version.

BMP-Brush


STYLE-Brush


Only the BMP on aktive row-position is missing.

There are some situations, it works :

MONO Color ( doesn't work )


Alternated Row-Color ( Works !!! )


Alternated Col-Color ( Works !!! )


// Color DOESN'T WORK !!!
// ----------------------------
IF  nArrayPos = 2 
	DEFINE IMAGE oImage1 RESOURCE "Help" 
        oBrw5:nRowHeight := oImage1:nWidth() + 4
	oImage1:End()
	DEFINE BRUSH oBrush5 COLOR 16105859
	oBrw5:SetBackGround( oBrush5 )
	RELEASE BRUSH oBrush5
	oBrw5:aCols[ 2 ]:AddResource("Help")
	oBrw5:aCols[ 2 ]:AddResource("Calendar")
        oBrw5:aCols[ 2 ]:bBmpData := {|| IIF( oBrw5:nArrayAt = 5, 1, 2 ) }
	oBrw5:Refresh()
ENDIF

// Alternate Row-Color WORKS !!!
// ------------------------------------
IF  nArrayPos = 3
	DEFINE IMAGE oImage1 RESOURCE "Help" 
        oBrw5:nRowHeight := oImage1:nWidth() + 4
	oImage1:End()
	oBrw5:nColDividerStyle	 := LINESTYLE_BLACK
	oBrw5:nRowDividerStyle := LINESTYLE_BLACK
	aClrCol := { { 0, 16105859 }, { 0, 16776960 } }
	oBrw5:bClrStd := { || aClrCol[ oBrw5:KeyNo % 2 + 1 ] } 
	oBrw5:aCols[ 2 ]:AddResource("Help")
	oBrw5:aCols[ 2 ]:AddResource("Calendar")
        oBrw5:aCols[ 2 ]:bBmpData := {|| IIF( oBrw5:nArrayAt = 5, 1, 2 ) }
ENDIF

// Alternate Col- Color WORKS !!!!
// -------------------------------------
IF  nArrayPos = 4
	DEFINE IMAGE oImage1 RESOURCE "Help" 
        oBrw5:nRowHeight := oImage1:nWidth() + 4
	oImage1:End()
	oBrw5:nColDividerStyle	 := LINESTYLE_BLACK
	oBrw5:nRowDividerStyle := LINESTYLE_BLACK
	aClrCol := { { 0, 16105859 }, { 0, 16776960 } } 
	lSELECT := .T.
	FOR nFOR := 1 TO LEN( oBrw5:aCols )
		IF lSELECT = .T. 
			oBrw5:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 1 + 2 ] }
			lSELECT := .F.
		ELSE
			oBrw5:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 1 ] }
			lSELECT := .T.
		ENDIF
	NEXT
	oBrw5:aCols[ 2 ]:AddResource("Help")
	oBrw5:aCols[ 2 ]:AddResource("Calendar")
        oBrw5:aCols[ 2 ]:bBmpData := {|| IIF( oBrw5:nArrayAt = 5, 1, 2 ) }	
ENDIF


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: TO GURUS : TRANSPARENT ERROR WITH XBROWSE
Posted: Sat Jan 24, 2009 05:32 PM

Dear Uwe,
How I can modify it ( as your working sample) ?

I make :

oApp():oGrid:bClrStd := { || Colores(oDCli) }

...
STATIC FUNCTION Colores(cdbf)
LOCAL aColo:={}
IF (cdbf)->(Ordkeyno()) % 2 == 0
aColo:={CLR_BLACK, RGB(193,221,255) }
ELSE
aColo:={CLR_BLACK, RGB(221,245,255) }
ENDIF
RETURN (aColo)

thanks

Best Regards, Saludos



Falconi Silvio