GRID Backcolor

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 1868
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 292 times
Been thanked: 67 times
Contact:

GRID Backcolor

Post by serge_girard » Fri Oct 03, 2014 10:11 am

It would be great if one could change backcolor of GRID after loading.
Something like:

Code: Select all

// grid with 7 colums
FOR i = 1 TO GetProperty ("Form_1", "Grid_1", "ItemCount")
	aItem := Form_1.Grid_1.Item ( i )  

   DO CASE 
   CASE aItem [7] == 'Y'
      SetProperty ("Form_1", "Grid_MESS", "BackColor", i,   { RED, RED, RED, RED, RED, RED, RED } )
   CASE aItem [1] == 'OK'
      SetProperty ("Form_1", "Grid_MESS", "BackColor", i,   { GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN } )
   CASE aItem [1] == 'NOK' .AND. aItem [7] == 'Y'
      SetProperty ("Form_1", "Grid_MESS", "BackColor", i,   { GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, RED } )
   OTHERWISE
   ENDCASE
   
NEXT i

Form_1.Grid_1.Refresh

Or perhaps it is allready possible?

Thanks and greetings,

Serge

User avatar
srvet_claudio
Posts: 1952
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 31 times
Been thanked: 120 times
Contact:

Post by srvet_claudio » Fri Oct 03, 2014 3:21 pm

See this code:

Code: Select all

DEFINE GRID Grid_1
...
DYNAMICBACKCOLOR {{||GridBackColor()},{||GridBackColor()},{||GridBackColor()},{||GridBackColor()},{||GridBackColor()},{||GridBackColor()},{||GridBackColor()}}
...



FUNCTION GridBackColor
LOCAL i

LOCAL aColors := {{ RED, RED, RED, RED, RED, RED, RED },;
                  { GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN },;
                  { GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, RED }}

LOCAL aItem := Form_1.Grid_1.Item ( This.CellRowIndex )

   DO CASE 
   CASE aItem [7] == 'Y'
      i := 1
   CASE aItem [1] == 'OK'
      i := 2
   CASE aItem [1] == 'NOK' .AND. aItem [7] == 'Y'
      i := 3
   OTHERWISE
      RETURN WHITE
   ENDCASE
RETURN aColors [i] [ This.CellColIndex ] 
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
serge_girard
Posts: 1868
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 292 times
Been thanked: 67 times
Contact:

Post by serge_girard » Fri Oct 03, 2014 4:12 pm

Thank you Claudio !

You are a real GENIUS !

Serge

User avatar
danielmaximiliano
Posts: 2045
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 87 times
Been thanked: 12 times
Contact:

Post by danielmaximiliano » Sat Oct 04, 2014 4:48 pm

Tendria que ser incluido en el Proximo Release
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Javier Tovar
Posts: 1274
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Fri Oct 17, 2014 3:29 pm

Excelente ejemplo! :) :) :)

Saludos

Javier Tovar
Posts: 1274
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Sat Jan 24, 2015 3:11 am

Hola a todos,

Hay forma de cambiar el color de FONTCOLOR en un Grid en tiempo de ejecusión?

Saludos

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Sat Jan 24, 2015 10:53 am

Javier Tovar wrote:Hay forma de cambiar el color de FONTCOLOR en un Grid en tiempo de ejecusión?
Si Javier, esto es posible. Solo caberia ver uma lógica para eso, porque se puede hacer a traves de:

- DynamicForeColor
- ColumnDYNAMICFORECOLOR

Ejemplos en SAMPLES GRID_40 y ultimos ejemplos que utilicé Grids (ViewError, GenInput...)

Pero creo que solo podrás cambias el color de la columna con ColumnDYNAMICFORECOLOR y con DynamicForeColor solo si atiende a alguna condicion. Puedes ver otro ejemplo en: viewtopic.php?p=31544#p31544

Para ver las sintaxis y otras propiedades del Grid, acesá a: C:/hmg.3.4.0/DOC/data/grid.htm
[url=file:///C:/hmg.3.4.0/DOC/data/grid.htm]C:/hmg.3.4.0/DOC/data/grid.htm[/url]

Espero haberte ayudado.

Saludos
Last edited by Pablo César on Sun Apr 02, 2017 1:57 am, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Javier Tovar
Posts: 1274
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Sat Jan 24, 2015 2:46 pm

Si Pablo César,
cuando iba a dormir me acorde que también había la propiedad de DynamicForeColor, pero ya era muy tarde y dije mañana veo cono es.

Gracias por recordar! Ahorita lo reviso.

Javier Tovar
Posts: 1274
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Wed Jun 14, 2017 5:23 pm

Si que ya llovió desde la ultima vez... Jajaja

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Tue Jun 20, 2017 12:46 am

Javier Tovar wrote:
Wed Jun 14, 2017 5:23 pm
Si que ya llovió desde la ultima vez... Jajaja
Hola Javier. No te entendi... :oops:
Lo que dijiste seria: es que pasó mucho para dar un retorno ?
Seria eso ? jijiji
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply