Page 1 of 1

GRID - COLOR

Posted: Sun Apr 29, 2018 10:47 pm
by SALINETAS24
Hola, tengo un GRID que muestra los registros de una DBF y dependiendo del valor que tenga uno de ellos pinta el resultado de dicha celda de color. Funciona correctamente.. MENOS CUANDO ES EL PRIMER REGISTRO el que tiene que cambiar de color.
Como está seleccionado por el CURSOR muestra los standares de WINDONS y no consigo modificarlo y que la celda tome el color de la condición aunque esté seleccionada. Os paso el código, es muy simple.
Hay alguna posibilidad de que se aplique la condición al registro seleccionado en el GRID.

Muchas gracias.

---> Y en inglés según el Dr. Google he dicho :lol:

Hello, I have a GRID that shows the records of a DBF and depending on the value that one of them has, it paints the result of said color cell. It works correctly .. LESS WHEN IS THE FIRST RECORD the one that has to change color.
As it is selected by the CURSOR it shows the standards of WINDONS and I can not modify it and the cell takes the color of the condition even if it is selected. I pass the code to you, it's very simple.
There is some possibility that the condition applies to the record selected in the GRID.

Thank you very much.

Code: Select all

		fColor := { || if ( This.CellValue = 1 ,"",IF(This.CellValue = 2,GREEN,IF(This.CellValue = 3,YELLOW,RED ))) }
		
		@ 140,430 GRID grid_2									;
			WIDTH  300  											;
			HEIGHT 300 											;		
			HEADERS { "F.Servicio", "Cantidad","Estado" }		;
			WIDTHS { 100 , 100 ,100 }							;
			ROWSOURCE "LPEDIDOS"								;
			COLUMNFIELDS { "Fecha_Se" , "Cantidad" , "ESTADO"}  ;
			DYNAMICFORECOLOR { , ,fColor  } ;
			ON DBLCLICK Actual_Grid_2(aField, .F., @lNuevo, aTipos) ;
			DYNAMICDISPLAY	 {bdDisplay_1  ,bdDisplay_1  , bdDisplay_3  } 

Re: GRID - COLOR

Posted: Mon Apr 30, 2018 2:03 am
by srvet_claudio
See in one of the last demos of the grid:

- Set colors and display mode in GRID cell navigation mode:

CellNavigationColor ( _SELECTEDCELL_FORECOLOR, aRGBcolor )

CellNavigationColor ( _SELECTEDCELL_BACKCOLOR, aRGBcolor )

CellNavigationColor ( _SELECTEDCELL_DISPLAYCOLOR, lBoolean )


CellNavigationColor ( _SELECTEDROW_FORECOLOR, aRGBcolor )

CellNavigationColor ( _SELECTEDROW_BACKCOLOR, aRGBcolor )

CellNavigationColor ( _SELECTEDROW_DISPLAYCOLOR, lBoolean )


- Get colors in GRID cell navigation mode:

aRGBcolor := CellNavigationColor ( _SELECTEDCELL_FORECOLOR )

aRGBcolor := CellNavigationColor ( _SELECTEDCELL_BACKCOLOR )


aRGBcolor := CellNavigationColor ( _SELECTEDROW_FORECOLOR )

aRGBcolor := CellNavigationColor ( _SELECTEDROW_BACKCOLOR )