Page 1 of 1

Lock Columns in grid

Posted: Tue Aug 28, 2012 6:12 pm
by danielmaximiliano
Hi Rathi/Everyone:
You can disable a column in a grid in particular, thereby unable to edit it? ?

Hola Rathi / Todos:
es posible bloquear una columna de un grid en especial, de ese modo no puedan editar la misma ? ?

Code: Select all

DEFINE GRID Articulos
        ROW    50
        COL    5
        WIDTH  735
        HEIGHT 460
        VALUE 1
        WIDTHS  { 50   , 140    ,260            ,130           ,150      }
        HEADERS {'Cant',' Codigo',' Descripción ',' P.Unitario ','Total'}
        FONTNAME "Arial"
        FONTSIZE 12
        TOOLTIP "Grid de Facturación"
        JUSTIFY { GRID_JTFY_RIGHT,GRID_JTFY_RIGHT, GRID_JTFY_LEFT  ,GRID_JTFY_RIGHT,GRID_JTFY_RIGHT} 
        COLUMNCONTROLS { {'COMBOBOX' , {'1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' , '11' , '12'  }} , ;
                         {'TEXTBOX'  ,'CHARACTER'              } , ;
                         {'TEXTBOX'  ,'CHARACTER'              } , ;
                         {'TEXTBOX'  ,'NUMERIC','$ 999999.99'  } , ;
                         {'TEXTBOX'  ,'NUMERIC','$ 999999.99'  } } 
        FONTBOLD .T.
        SHOWHEADERS .T.
        ON DBLCLICK SelectRow()
        ALLOWEDIT .T.
        CELLNAVIGATION .T.
        ITEMCOUNT 100
        BACKCOLOR NIL
        FONTCOLOR NIL
        HEADERIMAGES Nil
        ROWSOURCE Nil
        COLUMNFIELDS Nil
        ALLOWAPPEND .F.
        ALLOWDELETE .F.
        BUFFERED .F.
        ONSAVE Nil
        LOCKCOLUMNS 0
        DYNAMICBACKCOLOR {  bColor      , bColor      , bColor   , bColor   , bColor  } 
		DYNAMICFORECOLOR {  fColor      , fColor      , fColor   , fColor   , fColor  }
		    
    END GRID

Re: Lock Columns in grid

Posted: Tue Aug 28, 2012 7:11 pm
by Rathinagiri
You can disable editing a column using the columnwhen option.

For example, if you have three columns in a grid, and you don't want to allow editing the second column, use this,

coumnwhen { {||.t.}, {||.f.}, {||.t.} }

That's all!

Re: Lock Columns in grid

Posted: Tue Aug 28, 2012 7:16 pm
by danielmaximiliano
rathinagiri wrote:You can disable editing a column using the columnwhen option.

For example, if you have three columns in a grid, and you don't want to allow editing the second column, use this,

coumnwhen { {||.t.}, {||.f.}, {||.t.} }

That's all!
Thanks Rathi, was looking for info on LOCKCOLUMNS <nValue>
and only one example in

C:\hmg.3.0.42\SAMPLES\GRID.38\demo.prg

Re: Lock Columns in grid

Posted: Tue Aug 28, 2012 7:37 pm
by esgici
Hola Daniel
danielmaximiliano wrote:... was looking for info on LOCKCOLUMNS <nValue>
and only one example in

C:\hmg.3.0.42\SAMPLES\GRID.38\demo.prg
Perhaps meaning of LOCKCOLUMNS is a bit different.

Please enter LOCK + COLUMN in "advanced search" of forum.

Saludos

Re: Lock Columns in grid

Posted: Tue Aug 28, 2012 8:03 pm
by danielmaximiliano
Rathi : funciona perfectamente
works perfectly, I noticed something in the grid. when I change "Number" does not update the Total of the product
Ventas por Registradora.jpg
Ventas por Registradora.jpg (48.01 KiB) Viewed 4923 times
Ventas.jpg
Ventas.jpg (86.78 KiB) Viewed 4923 times

Code: Select all

Procedure ActualizaVenta()
 nRow := Ventas.Articulos.Value                                       //
 Ventas.Articulos.Cell(nRow,5) := Ventas.Articulos.Cell(nRow,4) * Ventas.Articulos.Cell(nRow,1)
 Ventas.Text_1.Value    := ''                                             //
 Ventas.nTotalArt.Value := 0                                              //
 Ventas.nTotal.Value    := 0.0  
   For nFor := 1 to Ventas.Articulos.ItemCount                              //
       aRow := Ventas.Articulos.Item(nFor)                                  //
       Ventas.nTotalArt.Value := Ventas.nTotalArt.Value  + Ventas.Articulos.Cell(nFor,1)       //
       Ventas.nTotal.Value    := Ventas.nTotal.Value     + (Ventas.Articulos.Cell(nFor,4) * Ventas.Articulos.Cell(nFor,1))      //
   Next   
Ventas.Articulos.Refresh
Return
I see the error. If you add up the items and the total.
but that article I modified the amount.

Re: Lock Columns in grid

Posted: Tue Aug 28, 2012 9:32 pm
by danielmaximiliano
Listo, Solucione el problema que no actualiza el Subtotal del producto.
Ventas por Registradora.jpg
Ventas por Registradora.jpg (46.47 KiB) Viewed 4916 times
con el siguiente codigo
ventas.jpg
ventas.jpg (46.96 KiB) Viewed 4916 times

Re: Lock Columns in grid

Posted: Wed Aug 29, 2012 2:44 am
by Rathinagiri
Hi,

To have accurate and immediate cell update, use ColumnValid option.