Page 1 of 1

How to change row backcolor in grid

Posted: Mon Oct 18, 2021 7:54 am
by mol
Hi!
I want to change defauld grey color of grid row when grid is out of focus.
We have function:

Code: Select all

CellNavigationColor ( _SELECTEDROW_BACKCOLOR, {0,196,255} )
But it changes colors only when grid is Cell Navigated

Re: How to change row backcolor in grid

Posted: Mon Oct 18, 2021 10:04 pm
by AUGE_OHR
hi,

as i can say Color of "Cursor" in GRID come from OS Theme
it is the same Color like Titlebar active/inactive

so you need OwnerDraw/CustomDraw to "paint" Color you want
Color_Panel.JPG
Color_Panel.JPG (281.84 KiB) Viewed 1561 times

Re: How to change row backcolor in grid

Posted: Tue Oct 19, 2021 12:20 pm
by gisjr134
[image][/image]
cGHYY1.jpg
cGHYY1.jpg (77.66 KiB) Viewed 1508 times

Greeting to All ,

I Tried to Do it in Grid Component , Something similar to ownerDraw , But it is not 100% , Because it's still flickering sometime . It´s like the windows receveing a message and paint its Background with Default Color.
nIndexEve1 := EventCreate( { || LabelEventH4() } , ListView_GetHeader(GetControlHandle( 'br_grid', cActiveJan )) )

Function xDrawHead()

//Local nHWnd := ListView_GetHeader(GetControlHandle( 'br_grid', cFormPrin ))
Local aMtrHeader := xGetHeader()
Local nHWnd := ListView_GetHeader(GetControlHandle( 'br_grid', cActiveJan ))
Local aM1 := {}
Local aTams1 := xGetInfoHead('TAM')
Local n1

For n1 := 1 To Len(aMtrHeader)
//Aadd(aM1 , hb_OemToAnsi(aMtrHeader[n1]) )

Aadd(aM1 , hb_Utf8ToStr(aMtrHeader[n1]) )
Aadd(aTams1 , aTams1[n1] )
Next


ControlBackX( nHWnd , {255,121,12} , aM1 , Len(aMtrHeader) , aTams1 , nColSel , nColOrder , 'img\setaa.bmp' , 'img\setab.bmp' , lAscendente )


Return

FUNCTION LabelEventH4(aLabel)

If (nMsg == WM_PAINT)
If !lInvalid
xDrawHead()
End If
End If

And whein i need to Repaint in the Correct Color(Header Backcolor of the Grid) , i do This.

If _isControlDefined( 'br_grid' , cactivejan )
BT_SCR_INVALIDATERECT( ListView_GetHeader(GetControlHandle( 'br_grid', cActivejan )) , Nil , .t. )
End If

To repeat the Process.

c1.jpg
c1.jpg (47 KiB) Viewed 1508 times
c2.jpg
c2.jpg (55.72 KiB) Viewed 1508 times
Anyone Know how to Fix This problem?

Re: How to change row backcolor in grid

Posted: Tue Oct 19, 2021 8:34 pm
by mol
AUGE_OHR wrote: Mon Oct 18, 2021 10:04 pm hi,

as i can say Color of "Cursor" in GRID come from OS Theme
it is the same Color like Titlebar active/inactive

so you need OwnerDraw/CustomDraw to "paint" Color you want
Color_Panel.JPG
How to realize it?

Re: How to change row backcolor in grid

Posted: Tue Oct 19, 2021 9:28 pm
by AUGE_OHR
hi Mol,
mol wrote: Tue Oct 19, 2021 8:34 pm How to realize it?
i´m afraid that OwnerDraw is not implement in HMG
as i can say Ownerdraw is only implement in GRID Header under HMG.

the Snapshot show my own native Control made for Xbase++

Re: How to change row backcolor in grid

Posted: Wed Oct 20, 2021 12:12 pm
by gisjr134
Hello To all ,

I Tried to use TsBrowse , a Version Adapted to Hmg wich has ownerDraw , but it didn´t work correctly.