HEADER a Color en GRID

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jorge_rivero
Posts: 24
Joined: Tue Nov 07, 2017 6:41 am
DBs Used: DBF, Mysql
Location: Capital Federal, Buenos Aires, ARGENTINA

HEADER a Color en GRID

Post by jorge_rivero »

Alguien sabe como poner color y tamaño en el Header de un GRID??
Si tienen un ejemplo seria genial.
Gracias
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: HEADER a Color en GRID

Post by gfilatov »

jorge_rivero wrote: Sun Apr 02, 2023 10:46 pm Alguien sabe como poner color y tamaño en el Header de un GRID??
Si tienen un ejemplo seria genial.
Gracias
Jorge,

Please take a look for the following forum message:

viewtopic.php?p=69713#p69713

BTW It is possible with Minigui Extended Version (look at the image below).
capture.png
capture.png (18.24 KiB) Viewed 1646 times
The actual code is below:

Code: Select all

...
      bColor := {|| iif ( This.CellRowIndex / 2 == Int( This.CellRowIndex / 2 ), { 128, 128, 128 }, { 192, 192, 192 } ) }
      fColor := {|| iif ( This.CellRowIndex / 2 == Int( This.CellRowIndex / 2 ), BLUE, RED ) }


      CellNavigationColor ( _SELECTEDCELL_FORECOLOR, BROWN )
      CellNavigationColor ( _SELECTEDCELL_BACKCOLOR, GREEN )
      CellNavigationColor ( _SELECTEDCELL_DISPLAYCOLOR, .T. )


      CellNavigationColor ( _SELECTEDROW_FORECOLOR, YELLOW )
      CellNavigationColor ( _SELECTEDROW_BACKCOLOR, BROWN )
      CellNavigationColor ( _SELECTEDROW_DISPLAYCOLOR, .T. )


      @ 50, 15 GRID Grid_1 ;
         WIDTH 750 ;
         AUTOSIZEHEIGHT 7 ;
         HEADERS { 'Last Name', 'First Name', '*--- Phone ----------------*', 'Row', 'Date' } ;
         WIDTHS { 140, 140, 40, 140, 140 } ;
         ITEMS aRows ;
         BACKCOLOR BLACK ;
         FONTCOLOR WHITE ;
         BOLD ;
         COLUMNCONTROLS { NIL, NIL, NIL, { 'SPINNER', 0, 50 }, { "DATEPICKER", "UPDOWN" } } ;
         VALUE 1 EDIT ;
         DYNAMICBACKCOLOR { bColor, bColor, bColor, bColor, bColor } ;
         DYNAMICFORECOLOR { fColor, fColor, fColor, fColor, fColor } ;
         TOOLTIP 'Editable Grid Control' ;
         CELLNAVIGATION

      Form_1.Grid_1.PAINTDOUBLEBUFFER := .T.

      Form_1.Grid_1.ColumnHEADER ( 1 ) := "--- Last Name ---"
      Form_1.Grid_1.ColumnWIDTH ( 1 ) := 100
      Form_1.Grid_1.ColumnJUSTIFY ( 1 ) := GRID_JTFY_CENTER
      Form_1.Grid_1.ColumnCONTROL ( 1 ) := { 'TEXTBOX', 'CHARACTER', '@!' }
      Form_1.Grid_1.ColumnDYNAMICFORECOLOR ( 1 ) := {|| BLACK }
      Form_1.Grid_1.ColumnDYNAMICBACKCOLOR ( 1 ) := {|| PURPLE }
      Form_1.Grid_1.HeaderDYNAMICFORECOLOR ( 1 ) := {|| BROWN }
      Form_1.Grid_1.HeaderDYNAMICBACKCOLOR ( 1 ) := {|| GREEN }
      FOR n := 2 TO 5
         Form_1.Grid_1.HeaderDYNAMICFORECOLOR ( n ) := {|| BLACK }
         Form_1.Grid_1.HeaderDYNAMICBACKCOLOR ( n ) := {|| { 192, 192, 192 } }
      NEXT
      Form_1.Grid_1.ColumnVALID ( 1 ) := {|| NIL }
      Form_1.Grid_1.ColumnWHEN ( 1 ) := {|| .F. }
      Form_1.Grid_1.ColumnONHEADCLICK ( 1 ) := {|| MsgInfo ( Form_1.Grid_1.ColumnHEADER( 1 ) ) }

      Form_1.Grid_1.AddItem ( { 'lolo', 'JUAN', '333-9999', 21, Date() } )
      Form_1.Grid_1.AddItem ( { 'Lolo', 'LOLO', '999-9999', 22, Date() - 1 }, NIL ) // Added this item in the END of the GRID
      Form_1.Grid_1.AddItem ( { 'hmg' , 'JUAN', '333-9999', 23, Date() - 1 },   3 ) // Added this item in Row 3
Hope that useful :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Post Reply