block cells in a grid at runtime
Moderator: Rathinagiri
- luisvasquezcl
- Posts: 1258
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
block cells in a grid at runtime
Hola a todos,
La función indicada a continuación permite bloquear o desbloquear una celda ( o las que quiera ) de un grid para su edición.
Normalmente podemos bloquear la edición de las celdas en tiempo de diseño completando la propiedad ColumnWhen.
Con este procedimiento obtengo el array que contiene la definicion de la propiedad ColumnWhen del grid y simplemente cambio el bloque de código definido para la columna de acuerdo a la condición que se desee.
Para que funcione el bloqueo antes de que se edite yo lo puse en el evento On Change del Grid por lo tanto cada vez que navego por las filas del grid me cambia el estado automáticamente de acuerdo a la condición que espero se cumpla.
En este ejemplo tengo un grid con 3 datos que son Id, Rut, Nombre. y verifico que si la celda ID está en 0 el usuario puede ingresar datos en la celda Rut en caso contrario no permite hacerlo, solo la celda Nombre.
static procedure lock_cell
local i := GetControlIndex ( "grid_1" , "Form_1" )
_HMG_SYSDATA[ 40 ] [ i ] [ 6 ] [ 2 ] := if( form_1.grid_1.cell(form_1.grid_1.value,1 ) <> 0, { || .f. } , { || .t. } )
return
Espero les sea de utilidad
Saludos cordiales,
Luis Vasquez
English By Google Translator
Hi all,
The function shown below to lock or unlock a cell (or want) a grid for editing.
Normally we can block cell editing at design time completing ColumnWhen property.
With this procedure I get an array that contains the definition of the grid ColumnWhen property and simply change the code block defined for the column according to the desired condition.
To operate the lock releases before I put it in the Grid On Change event so every time I browse the rows of the grid changes my status automatically according to the condition that hope is fulfilled.
In this example I have a grid with 3 data are Id, Ruth, Name. and verify that if the cell ID is 0 the user can enter data in cell Rut otherwise not allowed to do so, only the cell name.
static procedure lock_cell
local i := GetControlIndex ( "grid_1" , "Form_1" )
_HMG_SYSDATA[ 40 ] [ i ] [ 6 ] [ 2 ] := if( form_1.grid_1.cell(form_1.grid_1.value,1 ) <> 0, { || .f. } , { || .t. } )
return
I hope this will be useful
Best regards,
Luis Vasquez
La función indicada a continuación permite bloquear o desbloquear una celda ( o las que quiera ) de un grid para su edición.
Normalmente podemos bloquear la edición de las celdas en tiempo de diseño completando la propiedad ColumnWhen.
Con este procedimiento obtengo el array que contiene la definicion de la propiedad ColumnWhen del grid y simplemente cambio el bloque de código definido para la columna de acuerdo a la condición que se desee.
Para que funcione el bloqueo antes de que se edite yo lo puse en el evento On Change del Grid por lo tanto cada vez que navego por las filas del grid me cambia el estado automáticamente de acuerdo a la condición que espero se cumpla.
En este ejemplo tengo un grid con 3 datos que son Id, Rut, Nombre. y verifico que si la celda ID está en 0 el usuario puede ingresar datos en la celda Rut en caso contrario no permite hacerlo, solo la celda Nombre.
static procedure lock_cell
local i := GetControlIndex ( "grid_1" , "Form_1" )
_HMG_SYSDATA[ 40 ] [ i ] [ 6 ] [ 2 ] := if( form_1.grid_1.cell(form_1.grid_1.value,1 ) <> 0, { || .f. } , { || .t. } )
return
Espero les sea de utilidad
Saludos cordiales,
Luis Vasquez
English By Google Translator
Hi all,
The function shown below to lock or unlock a cell (or want) a grid for editing.
Normally we can block cell editing at design time completing ColumnWhen property.
With this procedure I get an array that contains the definition of the grid ColumnWhen property and simply change the code block defined for the column according to the desired condition.
To operate the lock releases before I put it in the Grid On Change event so every time I browse the rows of the grid changes my status automatically according to the condition that hope is fulfilled.
In this example I have a grid with 3 data are Id, Ruth, Name. and verify that if the cell ID is 0 the user can enter data in cell Rut otherwise not allowed to do so, only the cell name.
static procedure lock_cell
local i := GetControlIndex ( "grid_1" , "Form_1" )
_HMG_SYSDATA[ 40 ] [ i ] [ 6 ] [ 2 ] := if( form_1.grid_1.cell(form_1.grid_1.value,1 ) <> 0, { || .f. } , { || .t. } )
return
I hope this will be useful
Best regards,
Luis Vasquez
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: block cells in a grid at runtime
Gracias Luis por compartir con nosotros. Muy buena solucion !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: block cells in a grid at runtime
Thanks a lot!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: block cells in a grid at runtime
Hola Luis.
Podés cambiar en tiempo de ejecución cualquier control de edición de un Grid con GridEx de la librería HFCL.
Fíjate el ejemplo en C:\hmg.3.1.1\hfcl\Samples\GridEx
Un abrazo,
Claudio.
Podés cambiar en tiempo de ejecución cualquier control de edición de un Grid con GridEx de la librería HFCL.
Code: Select all
// FUNCTIONS
**********************************************************************************
* GRID_ColumnCount ---> Return the Number of Column on GRID
*
* GRID_AddColumnEx ---> Complement of Method: AddColumn (nColIndex)
* GRID_DeleteColumnEx ---> Complement of Method: DeleteColumn (nColIndex)
*
* GRID_GetColumnControlsEx ---> Return Array with Controls of Column(nColIndex) ==> {cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK}
*
* GRID_GetColumnControl ---> Return specific Control of Column(nColIndex) ==> [cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK]
* GRID_SetColumnControl ---> Set specific Control of Column(nColIndex) ==> [cCAPTION, nWIDTH, nJUSTIFY, aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK]
*
* GRID_GetColumnDisplayPos ---> Get the position of Column(nColIndex) in that display in the GRID
* GRID_SetColumnDisplayPos ---> Set the position of Column(nColIndex) in that display in the GRID
*
* GRID_GetColumnWidthDisplay -> Get the Width of Column(nColIndex) in that display in the GRID
*
* GRID_SetBkImage ---> Set background image in Grid
**********************************************************************************
// SYNTAX
**********************************************************************************
* GRID_ColumnCount (cControlName , [cParentForm])
* GRID_AddColumnEx (cControlName, [cParentForm], nColIndex, [aCOLUMNCONTROL], [bDYNAMICBACKCOLOR], [bDYNAMICFORECOLOR], [bCOLUMNWHEN], [bCOLUMNVALID], [bONHEADCLICK])
* GRID_DeleteColumnEx (cControlName, [cParentForm], nColIndex)
* GRID_GetColumnControlsEx (cControlName, [cParentForm], nColIndex)
* GRID_GetColumnControl (cControlName , [cParentForm], nControl, nColIndex)
* GRID_SetColumnControl (cControlName , [cParentForm], nControl, nColIndex, Data)
* GRID_GetColumnDisplayPos (cControlName, [cParentForm], nColIndex)
* GRID_SetColumnDisplayPos (cControlName, [cParentForm], nColIndex, nPos_Display)
* GRID_GetColumnWidthDisplay (cControlName, cParentForm, nColIndex)
* GRID_SetBkImage (cControlName, [cParentForm], nAction, cBMPFileName, yOffset, xOffset)
**********************************************************************************
Un abrazo,
Claudio.
- luisvasquezcl
- Posts: 1258
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: block cells in a grid at runtime
Gracias Claudio por la aclaración.
Tendré que darle una mirada al manual
Saludos cordiales,
Luis Vasquez
Tendré que darle una mirada al manual
Saludos cordiales,
Luis Vasquez
-
- Posts: 388
- Joined: Wed Nov 21, 2012 7:14 pm
- Location: México
Re: block cells in a grid at runtime
Hello
It only take a look at the sample executables that come in HFCL, and truly extraordinary, thank you for your time and dedication to Dr. Claudio HMG:!:
Greetings from Mexico
Polo
*-----------------------------------------------------------------------------------------------------------------------------
Hola
Solo le heche un vistazo a los ejecutables que vienen de ejemplo en HFCL, y en verdad extraordinarios, mil gracias por su tiempo y dedicación a HMG Dr. Claudio
Saludos desde México
Polo
It only take a look at the sample executables that come in HFCL, and truly extraordinary, thank you for your time and dedication to Dr. Claudio HMG:!:
Greetings from Mexico
Polo
*-----------------------------------------------------------------------------------------------------------------------------
Hola
Solo le heche un vistazo a los ejecutables que vienen de ejemplo en HFCL, y en verdad extraordinarios, mil gracias por su tiempo y dedicación a HMG Dr. Claudio
Saludos desde México
Polo
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: block cells in a grid at runtime
Polo, muchas gracias.Leopoldo Blancas wrote:Hello
It only take a look at the sample executables that come in HFCL, and truly extraordinary, thank you for your time and dedication to Dr. Claudio HMG:!:
Greetings from Mexico
Polo
*-----------------------------------------------------------------------------------------------------------------------------
Hola
Solo le heche un vistazo a los ejecutables que vienen de ejemplo en HFCL, y en verdad extraordinarios, mil gracias por su tiempo y dedicación a HMG Dr. Claudio
Saludos desde México
Polo
Saludos,
Claudio.
- giuper63
- Posts: 11
- Joined: Wed Oct 17, 2012 10:40 pm
- DBs Used: DBF, mysql, sqlite, PostgresSQL
- Location: Montecassiano
- Contact:
Re: block cells in a grid at runtime
Many thanks Claudio,
your post helped me very much to find the column width not only in grid but also in browse columns!
Great!
Greetings.
your post helped me very much to find the column width not only in grid but also in browse columns!
Great!
Greetings.
Giuseppe
Italian developer
Italian developer
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: block cells in a grid at runtime
Thanks Giuseppe.giuper63 wrote:Many thanks Claudio,
your post helped me very much to find the column width not only in grid but also in browse columns!
Great!
Greetings.
Regards,
Claudio.