Spinner in grid

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

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

Spinner in grid

Post by danielmaximiliano »

Hola a todos..
hoy me puse a modificar pequeñas cosas en un sistema TVP (POS : point of sale)
modifique una celda textbox numerico por un spinner el cual modifica la cantidad de articulos vendidos, un doble click permite modificar la cantidad entre 1 y 24 pero al seleccionar una x cantidad y darle enter por mas que lo envio a una rutina donde genera el precio total no se ve la modificacion
2020-12-30 23_38_48-Ventas Autoservicio Peréz 2021.png
2020-12-30 23_38_48-Ventas Autoservicio Peréz 2021.png (7.08 KiB) Viewed 627 times
Fila 1 : 1 articulo , $65, subtotal $65
Fila 2 : 2 articulos, $65 subtotal $130
modifico con el spinner la cantidad de la fila 2 en 1 producto y no se ve reflejado el cambio..

Code: Select all

    DEFINE GRID Articulos
        ROW    5
        COL    5
        WIDTH  748
        HEIGHT 470
        VALUE 1
        WIDTHS  {60  , 140     ,260            ,130           ,150      }
        HEADERS { 'Can' ,' Codigo',' Descripción ',' P.Unitario ','Total'  }
        FONTNAME "Arial"
        FONTSIZE 12
        JUSTIFY { GRID_JTFY_RIGHT, ;
                  GRID_JTFY_RIGHT, ;
                  GRID_JTFY_LEFT , ;
                  GRID_JTFY_RIGHT, ;
                  GRID_JTFY_RIGHT  } 
		COLUMNCONTROLS { {'SPINNER'  , 1  , 24                 } , ;
                         {'TEXTBOX'  ,'CHARACTER'              } , ;
                         {'TEXTBOX'  ,'CHARACTER'              } , ;
                         {'TEXTBOX'  ,'NUMERIC','$ 999999.99'  } , ;
                         {'TEXTBOX'  ,'NUMERIC','$ 999999.99'  } } 
		DYNAMICFORECOLOR { foreColor, foreColor, foreColor, foreColor , foreColor} 
		ON CHANGE ( ActualizaVenta() , Ventas.Text_1.Value   := '0'  , ventas.Text_1.SETFOCUS )
		FONTBOLD       .T.
        SHOWHEADERS    .T.
        ALLOWEDIT      .T.
        CELLNAVIGATION .F.
        ITEMCOUNT 100
    END GRID

Code: Select all

*----------------------------------------------------------------------------*
Procedure ActualizaVenta()
*----------------------------------------------------------------------------*
 Ventas.Text_1.Value                     := ''                                             
 Ventas.nTotalArt.Value                  := 0                                              
 Ventas.nTotal.Value                     := 0.0  
 
   For nFor := 1 to Ventas.Articulos.ItemCount                              
       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 ) )      //
       Ventas.Articulos.Cell( nFor , 5 ) := Ventas.Articulos.Cell( nFor , 4 ) * Ventas.Articulos.Cell( nFor , 1 )
   Next 
   Ventas.Articulos.Refresh
Ventas.Text_1.SetFocus
Return
si actualiza cuando ingreso otro producto... ¿ en que fallo?
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Spinner in grid

Post by andyglezl »

si actualiza cuando ingreso otro producto...
Hola Max

No estoy seguro. Pero a simple vista creo que así funciona el ON CHANGE,
ya que en el Grid al hacer cambio de línea/renglón, se ejecuta el ON CHANGE.

Si añades _PushKey( ) al final para simular un cambio de renglón, tal vez funcione...
*----------------------------------------------------------------------------------------------------------------
hi Max

I'm not sure. But at first glance I think that is how ON CHANGE works,
since in the Grid when changing the line / row, the ON CHANGE is executed.

If you add _PushKey () to the end to simulate a row change, it might work ...

Code: Select all

*----------------------------------------------------------------------------*
Procedure ActualizaVenta()
*----------------------------------------------------------------------------*
	Ventas.Text_1.Value                     := ''                                             
	Ventas.nTotalArt.Value                  := 0                                              
	Ventas.nTotal.Value                     := 0.0  
	
	For nFor := 1 to Ventas.Articulos.ItemCount                              
		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 ) )      //
       		Ventas.Articulos.Cell( nFor , 5 ) := Ventas.Articulos.Cell( nFor , 4 ) * Ventas.Articulos.Cell( nFor , 1 )
	Next 
	*---------------------------------------------------------
	_PushKey( VK_DOWN )
	_PushKey( VK_UP )
	*---------------------------------------------------------	
	Ventas.Articulos.Refresh
	Ventas.Text_1.SetFocus
Return
Andrés González López
Desde Guadalajara, Jalisco. México.
martingz
Posts: 401
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Spinner in grid

Post by martingz »

Daniel a mi me paso algo parecido y lo arregle de esta manera cunado doy el ultimo enter

aValues1:=altacotizacion.Grid_1.Item(nlineac) **Traigo los valores de la fila en la que doy enter

Altacotizacion.Grid_1.Item(nlineac):={aValues1[1],aValues1[2],transform(varcant,'999999999.999999') ,aValues1[4],aValues1[5] } ** aqui guardo en la linea los cambios

Saludps
pd. espero que te sea de ayuda
Post Reply