Lock Columns in grid

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Lock Columns in grid

Post 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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Lock Columns in grid

Post 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!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Lock Columns in grid

Post 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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Lock Columns in grid

Post 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
Viva INTERNATIONAL HMG :D
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Lock Columns in grid

Post 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 4907 times
Ventas.jpg
Ventas.jpg (86.78 KiB) Viewed 4907 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.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Lock Columns in grid

Post 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 4900 times
con el siguiente codigo
ventas.jpg
ventas.jpg (46.96 KiB) Viewed 4900 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Lock Columns in grid

Post by Rathinagiri »

Hi,

To have accurate and immediate cell update, use ColumnValid option.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply