Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid, highlighted row, would like cell to remain highlighted if clicked in...

Status
Not open for further replies.

GriffMG

Programmer
Mar 4, 2002
6,321
FR
Having a brain freeze or senior moment I think.

I have a form with a grid, the user likes that the currently selected record/row is highlighted but
would also like that same highlighting on a cell if the user clicks in it.

At the moment it changes so the background is white.

I've been playing with settings and not getting it - any ideas?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
I seem to have it resolved with the InteractiveChange event of an option group (Lighter, Darker, Darkest options for the user)

Code:
DO CASE
	CASE THIS.VALUE = 3
		THISFORM.GRID1.HIGHLIGHTBACKCOLOR = RGB(0,0,255)
		THISFORM.GRID2.HIGHLIGHTBACKCOLOR = RGB(0,0,255)
		THISFORM.GRID1.SETALL("BackColor", RGB(0,0,255), "Textbox")
		THISFORM.GRID1.SETALL("SelectedBackColor", RGB(0,0,255), "Textbox")
		THISFORM.GRID2.SETALL("BackColor", RGB(0,0,255), "Textbox")
		THISFORM.GRID2.SETALL("SelectedBackColor", RGB(0,0,255), "Textbox")
	CASE THIS.VALUE = 2
		THISFORM.GRID1.HIGHLIGHTBACKCOLOR = RGB(0,128,255)
		THISFORM.GRID2.HIGHLIGHTBACKCOLOR = RGB(0,128,255)
		THISFORM.GRID1.SETALL("BackColor", RGB(0,128,255), "Textbox")
		THISFORM.GRID1.SETALL("SelectedBackColor", RGB(0,128,255), "Textbox")
		THISFORM.GRID2.SETALL("BackColor", RGB(0,128,255), "Textbox")
		THISFORM.GRID2.SETALL("SelectedBackColor", RGB(0,128,255), "Textbox")
	CASE THIS.VALUE = 1
		THISFORM.GRID1.HIGHLIGHTBACKCOLOR = RGB(165,207,240)
		THISFORM.GRID2.HIGHLIGHTBACKCOLOR = RGB(165,207,240)
		THISFORM.GRID1.SETALL("BackColor", RGB(165,207,240), "Textbox")
		THISFORM.GRID1.SETALL("SelectedBackColor", RGB(165,207,240), "Textbox")
		THISFORM.GRID2.SETALL("BackColor", RGB(165,207,240), "Textbox")
		THISFORM.GRID2.SETALL("SelectedBackColor", RGB(165,207,240), "Textbox")
ENDCASE
STRTOFILE(STR(THIS.VALUE),m.WHEREAMI+"GridBkGnd.txt")

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Nice one Chris,

It does rather block the user from copying the contents of the cell though, rendering it 'disabled' in all but colour

Martin

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
This is what I have ended up with

Whole row in a user selected (Lighter, Darker and Darkest) highlight and the currently selected cell highlighted
and bordered in red... so the user can copy and paste from it.

The end user is having eye issues, so wants to be able to vary the exact colours on this one feature dependent
on how their eyes are feeling that day.

Noname_ui1kh1.gif


That data shown is all just for training purposes... so no GDPR issues here I hope

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Looks good. I also tried to set backstyle of the textbox to transparent, but didn't think about columns sparse being .T. by default.
So setting a backcolor only affects the active row and thus is keeping the row highlight color only in that row. Ideal.

On the other hand if you ever have the need for sparse=.F. column showing its control in every row, you'd also highlight that column.

Chriss
 
I did, accidentally, set the sparse on one column, but that made it visually confusing
(in my opinion) when the grid changed too much as focus passed from one column to another.

Oddly, I cannot see the image I submitted with my previous comment.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top