Control Grid

Forum help and suggestions to improve this forum.

Moderator: Rathinagiri

Post Reply
Mario Mansilla
Posts: 250
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina
Been thanked: 2 times

Control Grid

Post by Mario Mansilla » Wed May 29, 2019 2:02 am

Hello friends :
                     I have attached a small project where I have managed to do the following:
1 - show account statements in the grid control (Cargar)
2 - click column "Su Pago" to enter the amount to pay
3 - select checkbox to make the sum of the amounts

Now my desire is to achieve the following:
1 - Click on the checkbox
2 - When done automatically, the column "Su Pago" is edited
3 - Enter amount
4 - Press Enter to add the amounts.

From now, thank you for you help

regards
Mario Mansilla

Hola Amigos :
adjunto un pequeño proyecto donde he logrado realizar lo siguiente :
1 - mostrar en el control grid estados de cuenta (Cargar)
2 - click columna "Su Pago" para ingresar el importe a pagar
3 - seleccionar checkbox para que realize la suma de los importes

Ahora bien mi deseo es lograr lo siguiente :
1 - Hacer click en el checkbox
2 - Al realizarlo automaticamente se edite la columna "Su pago"
3 - Ingresar importe
4 - Presionar Enter para realizar la suma de los importes .

Desde ya muchas gracias por su ayuda

Saludos
Mario Mansilla
Attachments
Grid.rar
(15.12 KiB) Downloaded 46 times

User avatar
andyglezl
Posts: 1149
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 35 times
Been thanked: 68 times
Contact:

Post by andyglezl » Wed May 29, 2019 1:36 pm

Hola Mario

Quizá de esta forma te ayude...
*--------------------------------------------
Maybe in this way I will help you ...


Cambia en Main.fmg lo siguiente:

Code: Select all

        CELLNAVIGATION .T.	//  *******  CAMBIAR A .T. 

Y en Main.prg, en el PROCEDURE T_Provee añade al inicio:

Code: Select all

*-------------------
STATIC PROCEDURE T_Provee
*-------------------

Local i

c_Total   := 0

*-----------------------------------------	// AÑADIR
nRow := Main.Grid_1.CellRowClicked
Main.Grid_1.Value := { nRow, 9 }
HMG_PressKey(VK_RETURN)
*-----------------------------------------

If Main.Grid_1.CheckBoxEnabled == .T.
   For i = 1 To Main.Grid_1.ItemCount
      If Main.Grid_1.CheckBoxItem ( i ) == .T.
         Do Case
		 Case Main.Grid_1.CellEx (i,3) = "FC"
		    c_Total   := c_Total + Main.Grid_1.CellEx (i, 9) 
		 Case Main.Grid_1.CellEx (i,3) = "ND"
		    c_Total   := c_Total + Main.Grid_1.CellEx (i, 9) 
		 Case Main.Grid_1.CellEx (i,3) = "NC"
		    c_Total   := c_Total - Val(Main.Grid_1.CellEx (i, 7)) 
		 Endcase
      Endif		 
    Next
Endif

Main.Label_1.Value := Str(c_Total,12,2)

Return
Andrés González López
Desde Guadalajara, Jalisco. México.

Mario Mansilla
Posts: 250
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina
Been thanked: 2 times

Post by Mario Mansilla » Wed May 29, 2019 8:41 pm

Hola Andrés :
muchas gracias por tu ayuda , ahora cuando realizo el click en el checkbox , automáticamente puedo editar e ingresar el valor , lo único que no espera que ingrese el valor para realizar la siguiente sentencia que calcula el importe total .
Cómo debería implementar esto ? . quizas un do while hasta que presione Enter

Saludos
Mario Rafael Mansilla

*----------------------------------------- // AÑADIR
nRow := Main.Grid_1.CellRowClicked
Main.Grid_1.Value := { nRow, 9 }
HMG_PressKey(VK_RETURN)
*-----------------------------------------

*-- Aqui esperar que ingrese el valor

If Main.Grid_1.CheckBoxEnabled == .T.
For i = 1 To Main.Grid_1.ItemCount
If Main.Grid_1.CheckBoxItem ( i ) == .T.
Do Case
Case Main.Grid_1.CellEx (i,3) = "FC"
c_Total := c_Total + Main.Grid_1.CellEx (i, 9)
Case Main.Grid_1.CellEx (i,3) = "ND"
c_Total := c_Total + Main.Grid_1.CellEx (i, 9)
Case Main.Grid_1.CellEx (i,3) = "NC"
c_Total := c_Total - Val(Main.Grid_1.CellEx (i, 7))
Endcase
Endif
Next
Endif

User avatar
andyglezl
Posts: 1149
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 35 times
Been thanked: 68 times
Contact:

Post by andyglezl » Thu May 30, 2019 2:09 am

Bueno, tendrías que separar en 2 procedimientos...
*---------------------------------------------------------------
Well, you would have to separate in 2 procedures ...


Cambia en Main.fmg lo siguiente:

Code: Select all

       ONCHANGE Totales()
Y en el Main.prg, sería así:

Code: Select all

*-------------------
STATIC PROCEDURE T_Provee
*-------------------
Local nRow

nRow := Main.Grid_1.CellRowClicked
Main.Grid_1.Value := { nRow, 9 }
HMG_PressKey(VK_RETURN)

Return

*-------------------
STATIC PROCEDURE Totales
*-------------------
Local i
c_Total   := 0

If Main.Grid_1.CheckBoxEnabled == .T.
   For i = 1 To Main.Grid_1.ItemCount
      If Main.Grid_1.CheckBoxItem ( i ) == .T.
         Do Case
		 Case Main.Grid_1.CellEx (i,3) = "FC"
		    c_Total   := c_Total + Main.Grid_1.CellEx (i, 9) 
		 Case Main.Grid_1.CellEx (i,3) = "ND"
		    c_Total   := c_Total + Main.Grid_1.CellEx (i, 9) 
		 Case Main.Grid_1.CellEx (i,3) = "NC"
		    c_Total   := c_Total - Val(Main.Grid_1.CellEx (i, 7)) 
		 Endcase
      Endif		 
    Next
Endif

Main.Label_1.Value := Str(c_Total,12,2)
Return
Andrés González López
Desde Guadalajara, Jalisco. México.

Mario Mansilla
Posts: 250
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina
Been thanked: 2 times

Post by Mario Mansilla » Fri May 31, 2019 3:14 am

Hola Andrés :
perfecto funciona como deseaba .
Muchas gracias por tu ayuda .
Saludos
Mario Mansilla

Post Reply