FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse background color problem
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
xBrowse background color problem
Posted: Thu Dec 23, 2010 12:27 AM

I am reviewing a xBrowse sample (FW\samples\xbrwin7.prg) and I would like to change the background color of the browse to white (it is light gray in the sample). The xBrowse BACKGROUND clause is just defined as a blank string in the example.

@ 10, 10 XBROWSE oBrw...BACKGROUND ""

I have tried BACKGROUND CLR_WHITE and it does not change the color.

I have also tried oBrw:setColor(, CLR_WHITE) (without the BACKGROUND clause) and the background is white, but the previously highlighted record is not redrawn properly when the arrow keys are used to move the current record. And there is also a delayed redraw when the mouse is used to select a new record.

There is no documentation for the BACKGROUND clause in the FW Wiki so I am not sure how to use it.

Does anyone have any ideas?

I am using FWH 10.8 with xHarbour.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: xBrowse background color problem
Posted: Thu Dec 23, 2010 10:37 AM
Hello James,

BACKGROUND is used usual for Brushes like :

1.
local aGrad := { { 0.5, RGB( 140, 56, 6 ), RGB( 237, 234, 109 ) }, ;
{ 0.5, RGB( 237, 234, 109 ), RGB( 85, 62, 84 ) } }

@ 10, 10 XBROWSE oBrw OF oDlg BACKGROUND aGrad VERTICAL


2.
@ 10, 10 XBROWSE oBrw OF oDlg BACKGROUND "..\bitmaps\Cartoon.bmp" BCK_TILED
// ACTION oBrw:SetBackGround() // Clear
// ACTION oBrw:SetBackGround( nil, BCK_TILED )
// ACTION oBrw:SetBackGround( nil, BCK_STRETCH )
// ACTION oBrw:SetBackGround( nil, BCK_FILL )


But You can use BACKGROUND for a Color as well, just define a Gradient with 2 same Colors

@ 10, 10 XBROWSE oBrw OF oDlg BACKGROUND {{ 1, 16777215, 16777215 }} // White



Best Regard and MERRY CHRISTMAS to You and Your family
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: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse background color problem
Posted: Thu Dec 23, 2010 04:10 PM

Uwe,

OK, that does it. Thanks.

Looking at the setBackground() method I see that it gets complicated as it will accept an array, character, number or object. Do you have any examples of using the other parameters?

Antonio, I notice the use of the CARGO var in this method. Isn't CARGO supposed to be reserved for programmer use? Wouldn't it be better to create a new DATA element instead of using CARGO within the browse class?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse background color problem
Posted: Fri Dec 24, 2010 06:51 AM

Mr. James

As you already observed, the BACKGROUND clause in turn calls the SetBackGround method with two parameters uBackGround and nBackgroundMode.

uBackGround can be character, array, numeric or object.

Character:
Can be name of an image file on the disk. ( bmp or any image ) or a resource name.

Array:
Valid Gradient Array

Numeric:
Valid bitmap handle

Object:
Valid bitmap or brush object.

It is easier to specify the background mode in command style as "TILED (default)", "STRETCH" or "FILL" for images ( imagefile name, bitmap handle or object) or as "VERTICAL (default)" or "HORIZONTAL" for Gradients.

The setbackground method does not use Cargo of XBrowse. Cargo is totally left for the programmers' use. What this method uses is the Cargo of its internal brush object. This usages does not disturb any of the programmers' objects.

Even if we specify a brush object as the background, XBrowse does not use the same brush object. XBrowse creates its own brush with a clone of the bitmap handle of the brush. The reason is we may create a brush and use it for various controls. The brush inside the xbrowse is susceptible for resizing. The intention of cloning the brush is not to affect our brush object with the changes/resizing that happens within the xbrowse. For this reason, usage of cargo of its own brush object by xbrowse does not in any way affect the brush objects defined in the application program.

It would have been of much help if all this documentation is made available in the Wiki.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse background color problem
Posted: Fri Dec 24, 2010 04:56 PM

Rao,

Thanks for the detailed explaination. It was very helpful.

Any ideas on redrawing the bitmap so the original background doesn't show? It seems it would be helpful if this type of highlight bar was a built-in option of the xbrowse class (and that it could automatically handle bitmaps too). If we can figure out how to fix the bitmap, then perhaps we can make this suggestion to Antonio.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse background color problem
Posted: Fri Dec 24, 2010 05:02 PM
James Bott wrote:Rao,

Thanks for the detailed explaination. It was very helpful.

Any ideas on redrawing the bitmap so the original background doesn't show? It seems it would be helpful if this type of highlight bar was a built-in option of the xbrowse class (and that it could automatically handle bitmaps too). If we can figure out how to fix the bitmap, then perhaps we can make this suggestion to Antonio.

Regards,
James

The logic that was originally suggested for win7 bar is not suitable for drawing bitmaps over it. Soon we may expect FWH to natively provide this in Xbrowse.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse background color problem
Posted: Wed Dec 29, 2010 07:58 AM

Please see the topic

viewtopic.php?f=3t=20570

&

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion