xBrowse background color problem

xBrowse background color problem

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse background color problem

Postby ukoenig » 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

Image

Best Regard and MERRY CHRISTMAS to You and Your family
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: xBrowse background color problem

Postby James Bott » Thu Dec 23, 2010 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse background color problem

Postby nageswaragunupudi » Fri Dec 24, 2010 6: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
User avatar
nageswaragunupudi
 
Posts: 10489
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse background color problem

Postby James Bott » Fri Dec 24, 2010 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse background color problem

Postby nageswaragunupudi » Fri Dec 24, 2010 5: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
User avatar
nageswaragunupudi
 
Posts: 10489
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse background color problem

Postby nageswaragunupudi » Wed Dec 29, 2010 7:58 am

Please see the topic

viewtopic.php?f=3&t=20570
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10489
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 43 guests