HMG Help

Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
  1. And here is my variation on the change of colors in Grid. I used my "color map" to be able to color specific cells, rows and columns regardless of their value.
    I hope it will be helpful.
    Bez tytułu.png

    Statistics: Posted by edk — Mon Jul 23, 2018 11:23 am


  2. Quizá de esta forma te sirva...
    --------------------------------------
    Maybe in this way it will serve you...


    grid2.rar

    gridx.png
    the file does not decompress

    Statistics: Posted by jairpinho — Mon Jul 23, 2018 10:11 am


  3. Quizá de esta forma te sirva...
    --------------------------------------
    Maybe in this way it will serve you...

    gridx.png

    Statistics: Posted by andyglezl — Mon Jul 23, 2018 3:00 am


  4. Yo sigo sin entender...
    -----------------------------
    I still dont get it...
    I can not delete the grid items just add new items,
    but the already added items will change the value
    of just one cell
    and when that happens I need to change the cell's heart.
    ------------------------------------------------------------------------------------------------------------------------------------------
    No puedo eliminar los elementos de la grilla simplemente agregue
    nuevos elementos, pero los elementos ya agregados cambiarán el
    valor de una sola celda
    y cuando eso suceda necesito cambiar el corazón de la celda.
    Quizá quisiste decir "Color" en vez de "Valor" ???
    -----------------------------------------------------------
    Maybe you wanted to say "Color" instead of "Value" ???


    De la siguiente forma, los elementos tienen el mismo color que todos los demas del grid.
    -----------------------------------------------------------------------------------------------------------------------------
    In the following way, the elements have the same color as all the other elements of the grid.

    CODE:

    #include "hmg.ch"#define _DEMO_GRID_#ifdef _DEMO_GRID_declare windown form_1Function MainLocal aRows := {}Private bColor:= { || if( This.CellRowIndex/2 == int(This.CellRowIndex/2), BLUE , RED ) }//{}// ******************************Private fColor:= {} //IF HMG SUPPORT UNICODE RUN// IF HMG SUPPORT UNICODE STOP// MsgDebug demo//---------------------------------------------------------------------------------------   n:= 10   aData := { "Number", 38, "aRGB", YELLOW, "Hello" }//   cMsg  := MsgDebug ( TIME(), aData, {|| NIL}, .F., EVAL({|| DATE ()}), n == 3 )      aRows := ARRAY (20)      aRows [1]   := {'Simpson',    'Homer',       '555-5555',   1, HMG_TimeToTime( TIME(), _TIMESHORT12H )}      aRows [2]   := {'Mulder',     'Fox',         '324-6432',   2, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [3]   := {'Smart',      'Max',         '432-5892',   3, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [4]   := {'Grillo',     'Pepe',        '894-2332',   4, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [5]   := {'Kirk',       'James',       '346-9873',   5, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [6]   := {'Barriga',    'Carlos',      '394-9654',   6, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [7]   := {'Flanders',   'Ned',         '435-3211',   7, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [8]   := {'Smith',      'John',        '123-1234',   8, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [9]   := {'Pedemonti',  'Flavio',      '000-0000',   9, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [10]  := {'Gomez',      'Juan',        '583-4832',  10, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [11]  := {'Fernandez',  'Raul',        '321-4332',  11, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [12]  := {'Borges',     'Javier',      '326-9430',  12, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [13]  := {'Alvarez',    'Alberto',     '543-7898',  13, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [14]  := {'Gonzalez',   'Ambo',        '437-8473',  14, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [15]  := {'Batistuta',  'Gol',         '485-2843',  15, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [16]  := {'Vinazzi',    'Amigo',       '394-5983',  16, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [17]  := {'Pedemonti',  'Flavio',      '534-7984',  17, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [18]  := {'Samarbide',  'Armando',     '854-7873',  18, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [19]  := {'Pradon',     'Alejandra',   '???-????',  19, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [20]  := {'Reyes',      'Monica',      '432-5836',  20, HMG_TimeToTime( TIME(), _TIMESHORT12H )}         //bColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , {128,128,128} , {192,192,192} ) }      //fColor := { || if ( 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.)/*      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.ColumnVALID (1) := {|| NIL}      Form_1.Grid_1.ColumnWHEN (1) := {|| NIL}      Form_1.Grid_1.ColumnONHEADCLICK (1) := {|| MsgInfo (Form_1.Grid_1.ColumnHEADER(1))}      Form_1.Grid_1.ColumnONHEADCLICK (3) := {|| Form_1.Grid_1.ColumnWIDTH (3) := GRID_WIDTH_AUTOSIZEHEADER}      Form_1.Grid_1.ColumnONHEADCLICK (5) := {|| Form_1.Grid_1.ColumnWIDTH (5) := GRID_WIDTH_AUTOSIZE}*/Load Window Fomr_1FOR i=1 TO 20Fomr_1.Grid_1.AddItem   ( {'lolo','JUAN','333-9999', 21, HMG_TimeToTime(TIME(),_TIMESHORT12H)}      )   // Added this item in the END of the GRID Fomr_1.Grid_1.AddItemEx ( {'Lolo','LOLO','333-9999', 22, HMG_TimeToTime(TIME(),_TIMESHORT12H)}, NIL )   // Added this item in the END of the GRIDFomr_1.Grid_1.AddItemEx ( {'hmg', 'JUAN','333-9999', 23, HMG_TimeToTime(TIME(),_TIMESHORT12H)},   3 )   // Added this item in Row 3NEXTFomr_1.CenterFomr_1.ActivateReturnfunction cor()bColor := { || if( This.CellRowIndex/2 == int(This.CellRowIndex/2), BLUE , RED ) }//bColor := { || RED  }//DoMethod( 'Fomr_1', "Grid_1", "Refresh", .T. )return#endif

    Quizá quisiste decir "Color" en vez de "Valor" sim color
    -----------------------------------------------------------
    Maybe you wanted to say "Color" instead of "Value" yes color

    Statistics: Posted by jairpinho — Sun Jul 22, 2018 8:23 pm


  5. Yo sigo sin entender...
    -----------------------------
    I still dont get it...
    I can not delete the grid items just add new items,
    but the already added items will change the value
    of just one cell
    and when that happens I need to change the cell's heart.
    ------------------------------------------------------------------------------------------------------------------------------------------
    No puedo eliminar los elementos de la grilla simplemente agregue
    nuevos elementos, pero los elementos ya agregados cambiarán el
    valor de una sola celda
    y cuando eso suceda necesito cambiar el corazón de la celda.
    Quizá quisiste decir "Color" en vez de "Valor" ???
    -----------------------------------------------------------
    Maybe you wanted to say "Color" instead of "Value" ???


    De la siguiente forma, los elementos tienen el mismo color que todos los demas del grid.
    -----------------------------------------------------------------------------------------------------------------------------
    In the following way, the elements have the same color as all the other elements of the grid.

    CODE:

    #include "hmg.ch"#define _DEMO_GRID_#ifdef _DEMO_GRID_declare windown form_1Function MainLocal aRows := {}Private bColor:= { || if( This.CellRowIndex/2 == int(This.CellRowIndex/2), BLUE , RED ) }//{}// ******************************Private fColor:= {} //IF HMG SUPPORT UNICODE RUN// IF HMG SUPPORT UNICODE STOP// MsgDebug demo//---------------------------------------------------------------------------------------   n:= 10   aData := { "Number", 38, "aRGB", YELLOW, "Hello" }//   cMsg  := MsgDebug ( TIME(), aData, {|| NIL}, .F., EVAL({|| DATE ()}), n == 3 )      aRows := ARRAY (20)      aRows [1]   := {'Simpson',    'Homer',       '555-5555',   1, HMG_TimeToTime( TIME(), _TIMESHORT12H )}      aRows [2]   := {'Mulder',     'Fox',         '324-6432',   2, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [3]   := {'Smart',      'Max',         '432-5892',   3, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [4]   := {'Grillo',     'Pepe',        '894-2332',   4, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [5]   := {'Kirk',       'James',       '346-9873',   5, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [6]   := {'Barriga',    'Carlos',      '394-9654',   6, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [7]   := {'Flanders',   'Ned',         '435-3211',   7, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [8]   := {'Smith',      'John',        '123-1234',   8, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [9]   := {'Pedemonti',  'Flavio',      '000-0000',   9, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [10]  := {'Gomez',      'Juan',        '583-4832',  10, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [11]  := {'Fernandez',  'Raul',        '321-4332',  11, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [12]  := {'Borges',     'Javier',      '326-9430',  12, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [13]  := {'Alvarez',    'Alberto',     '543-7898',  13, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [14]  := {'Gonzalez',   'Ambo',        '437-8473',  14, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [15]  := {'Batistuta',  'Gol',         '485-2843',  15, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [16]  := {'Vinazzi',    'Amigo',       '394-5983',  16, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [17]  := {'Pedemonti',  'Flavio',      '534-7984',  17, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [18]  := {'Samarbide',  'Armando',     '854-7873',  18, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [19]  := {'Pradon',     'Alejandra',   '???-????',  19, HMG_TimeToTime( TIME(), _TIMESHORT12H )}       aRows [20]  := {'Reyes',      'Monica',      '432-5836',  20, HMG_TimeToTime( TIME(), _TIMESHORT12H )}         //bColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , {128,128,128} , {192,192,192} ) }      //fColor := { || if ( 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.)/*      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.ColumnVALID (1) := {|| NIL}      Form_1.Grid_1.ColumnWHEN (1) := {|| NIL}      Form_1.Grid_1.ColumnONHEADCLICK (1) := {|| MsgInfo (Form_1.Grid_1.ColumnHEADER(1))}      Form_1.Grid_1.ColumnONHEADCLICK (3) := {|| Form_1.Grid_1.ColumnWIDTH (3) := GRID_WIDTH_AUTOSIZEHEADER}      Form_1.Grid_1.ColumnONHEADCLICK (5) := {|| Form_1.Grid_1.ColumnWIDTH (5) := GRID_WIDTH_AUTOSIZE}*/Load Window Fomr_1FOR i=1 TO 20Fomr_1.Grid_1.AddItem   ( {'lolo','JUAN','333-9999', 21, HMG_TimeToTime(TIME(),_TIMESHORT12H)}      )   // Added this item in the END of the GRID Fomr_1.Grid_1.AddItemEx ( {'Lolo','LOLO','333-9999', 22, HMG_TimeToTime(TIME(),_TIMESHORT12H)}, NIL )   // Added this item in the END of the GRIDFomr_1.Grid_1.AddItemEx ( {'hmg', 'JUAN','333-9999', 23, HMG_TimeToTime(TIME(),_TIMESHORT12H)},   3 )   // Added this item in Row 3NEXTFomr_1.CenterFomr_1.ActivateReturnfunction cor()bColor := { || if( This.CellRowIndex/2 == int(This.CellRowIndex/2), BLUE , RED ) }//bColor := { || RED  }//DoMethod( 'Fomr_1', "Grid_1", "Refresh", .T. )return#endif

    Statistics: Posted by andyglezl — Sun Jul 22, 2018 7:58 pm