Problema con Grid

HMG en Español

Moderator: Rathinagiri

Post Reply
gabrieloq
Posts: 46
Joined: Thu Jan 24, 2013 9:45 pm
Location: Bucaramanga

Problema con Grid

Post by gabrieloq »

Por favor necesito una ayuda con un grid que tengo en una aplicación. NO me aparece el contenido, navega bien pero sin mostrar nada o la pantalla en negro, utilizo 3.0.46. Aveces deja ver el contenido pero la gran mayoria de veces esta oculto lo datos y si entro a las otras opciones de la aplicacion pasa lo mismo

Code: Select all

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._	
PROCEDURE UsarPlantilla

dbSelectArea("TemPlant")
zap
INDEX ON  Servicio + Codigo + Nombre    TAG Nombre  TO \Archivo\Curarte\TemPlant.Cdx     
SET ORDER TO TAG Nombre

aCtrl_1 := {'TEXTBOX','CHARACTER'}
aCtrl_2 := {'CHECKBOX','CHARACTER'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'TEXTBOX','CHARACTER'}
aCtrl_5 := {'TEXTBOX','CHARACTER'}
aCtrl_6 := {'TEXTBOX','NUMERIC','999'}

bColor := { || if ( valtype ( This.CellValue ) == 'C', if ( This.CellValue = '*' , { 41,222,237 } , { 255,255,255 } ), { 255,255,255 } ) }
 
DEFINE WINDOW W_Imp1     ;
   AT 10,10              ;
   WIDTH 1100 HEIGHT 580 ;
   TITLE "   "           ;
   MODAL      

   @ 45,10 LABEL L_Fec1 VALUE 'Plantillas' 
    
	@ 45, 110 COMBOBOX Control_1	    	  ;
			ITEMSOURCE Plantilla->Nombre	  ; 
			VALUESOURCE Plantilla->Codigo     ;
			WIDTH 250 HEIGHT 100	          ;
			FONT "Arial" SIZE 9	        	  ;
			ON LOSTFOCUS mandar( This.Value ) ;
			TOOLTIP "Codigo de la Plantilla"  
    
	@ 45, 380 BUTTON B_Man CAPTION 'Aceptar'    ACTION mandar( W_Imp1.Control_1.Value )
	
    @ 80,10 GRID Grid_P1                     ;
	    WIDTH 1070                           ;
	    HEIGHT 400                           ;
	    HEADERS { 'Selecciona','Descripción','Prescripción','Via','Cantidad'}  ;
	    WIDTHS { 50, 500, 300, 120, 80}      ;
		VALUE { 1 , 1 }                      ;
		ROWSOURCE "TemPlant"	             ;
		COLUMNCONTROLS { aCtrl_1 , aCtrl_3 , aCtrl_4 , aCtrl_5, aCtrl_6 } ;
		COLUMNFIELDS { 'Si', 'Nombre','Prescribe','Via','Cantidad' }      ;
		DYNAMICBACKCOLOR { bColor, bColor , bColor, bColor, bColor } ;
		CELLNAVIGATION ;
		EDIT           ;
		ALLOWAPPEND 
		
   @ 495, 200 BUTTON B_Agr CAPTION 'Agregar Item'    ACTION AgregaItem()
   
   @ 510, 510 BUTTON B_Ace CAPTION 'Grabar'          ACTION ImPlant()

   @ 510, 635 BUTTON B_Can CAPTION 'Salir'           ACTION W_Imp1.release
END WINDOW

CENTER WINDOW W_Imp1
ACTIVATE WINDOW W_Imp1
   
Return Nil

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._		

FUNCTION  mandar( cConc )

abre_ArcPl( cConc )

RETURN NIL

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._		

function abre_ArcPl( cConc )
aPide  := {}
aPlant := {}
nI := 0

if cConc = NIL  .or. Empty( cConc )
   return .f.
endif   

dbSelectArea("TemPlant")
zap
INDEX ON  Servicio + Codigo + Nombre    TAG Nombre  TO \Archivo\Curarte\TemPlant.Cdx     
SET ORDER TO TAG Nombre

dbSelectArea("DetPlant")
dbSeek( cConc )
while !eof()
   
   if DetPlant->Plantilla  # cConc
      dbSkip()
      loop
   endif
   
   Plantilla->( dbSeek( DetPlant->Plantilla ) )

   if DetPlant->Via  = 1
      cVia := "Oral"
   elseif DetPlant->Via  = 2
          cVia := "IntraMuscular"
   elseif DetPlant->Via  = 3
          cVia := "SubCutanea"
   else
      cVia := "            "
   endif		  

   dbSelectArea("TemPlant")
   Amplia( 5, "TemPlant", cQuien )
   TemPlant->E           := if( DetPlant->Codigo = space(7), "*", " " )
   TemPlant->Historia    := Registro->Historia
   TemPlant->Registro    := Registro->Registro
   TemPlant->Fecha       := Registro->Fecha
   TemPlant->Codigo      := DetPlant->Codigo
   TemPlant->Servicio    := DetPlant->Servicio
   TemPlant->Nombre      := if( DetPlant->Codigo = space(7), "*****  ", "" ) + ALLTRIM(DetPlant->Nombre ) + if( DetPlant->Codigo = space(7), "  *****", "" )
   TemPlant->Prescribe   := DetPlant->Prescribe
   TemPlant->Via         := cVia
   TemPlant->Cantidad    := DetPlant->Cantidad
   dbUnlock()
   
   aadd( aPlant, { .f., DetPlant->Nombre, DetPlant->Prescribe, cVia, DetPlant->Cantidad } )
   aadd( aPide, { .f., DetPlant->Nombre, DetPlant->Prescribe, cVia, DetPlant->Cantidad, Registro->Historia, Registro->Registro, Registro->Fecha, Plantilla->Codigo } )
   
   dbSelectArea("DetPlant")
   dbSkip()
end do   

dbSelectArea("TemPlant")
dbGotop()
W_Imp1.Grid_P1.Refresh

Return NIL
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._		
De antemano gracias por la ayuda... me es urgente, gracias
Attachments
error.png
error.png (70.55 KiB) Viewed 4097 times
mostrar.png
mostrar.png (79.79 KiB) Viewed 4097 times
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Problema con Grid

Post by danielmaximiliano »

Hola Gabriel :
a simple vista no veo errores en tu codigo, pero sin los datos de la tabla va a ser dificil comprobar el funcionamiento del mismo.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Problema con Grid

Post by Javier Tovar »

Hola Gabriel,
danielmaximiliano wrote:Hola Gabriel :
a simple vista no veo errores en tu codigo, pero sin los datos de la tabla va a ser dificil comprobar el funcionamiento del mismo.
+1

Saludos
User avatar
cmaciass
Posts: 16
Joined: Sat Jun 01, 2013 2:45 am
Location: Zacatecas, Mexico

Re: Problema con Grid

Post by cmaciass »

Javier Tovar wrote:Hola Gabriel,
danielmaximiliano wrote:Hola Gabriel :
a simple vista no veo errores en tu codigo, pero sin los datos de la tabla va a ser dificil comprobar el funcionamiento del mismo.
+1

Saludos
gabrieloq wrote:Por favor necesito una ayuda con un grid que tengo en una aplicación. NO me aparece el contenido, navega bien pero sin mostrar nada o la pantalla en negro, utilizo 3.0.46. Aveces deja ver el contenido pero la gran mayoria de veces esta oculto lo datos y si entro a las otras opciones de la aplicacion pasa lo mismo

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._

Code: Select all

PROCEDURE UsarPlantilla

dbSelectArea("TemPlant")
zap
INDEX ON  Servicio + Codigo + Nombre    TAG Nombre  TO \Archivo\Curarte\TemPlant.Cdx     
SET ORDER TO TAG Nombre

aCtrl_1 := {'TEXTBOX','CHARACTER'}
aCtrl_2 := {'CHECKBOX','CHARACTER'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'TEXTBOX','CHARACTER'}
aCtrl_5 := {'TEXTBOX','CHARACTER'}
aCtrl_6 := {'TEXTBOX','NUMERIC','999'}

bColor := { || if ( valtype ( This.CellValue ) == 'C', if ( This.CellValue = '*' , { 41,222,237 } , { 255,255,255 } ), { 255,255,255 } ) }
 
DEFINE WINDOW W_Imp1     ;
   AT 10,10              ;
   WIDTH 1100 HEIGHT 580 ;
   TITLE "   "           ;
   MODAL      

   @ 45,10 LABEL L_Fec1 VALUE 'Plantillas' 
    
	@ 45, 110 COMBOBOX Control_1	    	  ;
			ITEMSOURCE Plantilla->Nombre	  ; 
			VALUESOURCE Plantilla->Codigo     ;
			WIDTH 250 HEIGHT 100	          ;
			FONT "Arial" SIZE 9	        	  ;
			ON LOSTFOCUS mandar( This.Value ) ;
			TOOLTIP "Codigo de la Plantilla"  
    
	@ 45, 380 BUTTON B_Man CAPTION 'Aceptar'    ACTION mandar( W_Imp1.Control_1.Value )
	
    @ 80,10 GRID Grid_P1                     ;
	    WIDTH 1070                           ;
	    HEIGHT 400                           ;
	    HEADERS { 'Selecciona','Descripción','Prescripción','Via','Cantidad'}  ;
	    WIDTHS { 50, 500, 300, 120, 80}      ;
		VALUE { 1 , 1 }                      ;
		ROWSOURCE "TemPlant"	             ;
		COLUMNCONTROLS { aCtrl_1 , aCtrl_3 , aCtrl_4 , aCtrl_5, aCtrl_6 } ;
		COLUMNFIELDS { 'Si', 'Nombre','Prescribe','Via','Cantidad' }      ;
		DYNAMICBACKCOLOR { bColor, bColor , bColor, bColor, bColor } ;
		CELLNAVIGATION ;
		EDIT           ;
		ALLOWAPPEND 
		
   @ 495, 200 BUTTON B_Agr CAPTION 'Agregar Item'    ACTION AgregaItem()
   
   @ 510, 510 BUTTON B_Ace CAPTION 'Grabar'          ACTION ImPlant()

   @ 510, 635 BUTTON B_Can CAPTION 'Salir'           ACTION W_Imp1.release
END WINDOW

CENTER WINDOW W_Imp1
ACTIVATE WINDOW W_Imp1
   
Return Nil

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._		

FUNCTION  mandar( cConc )

abre_ArcPl( cConc )

RETURN NIL

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._		

function abre_ArcPl( cConc )
aPide  := {}
aPlant := {}
nI := 0

if cConc = NIL  .or. Empty( cConc )
   return .f.
endif   

dbSelectArea("TemPlant")
zap
INDEX ON  Servicio + Codigo + Nombre    TAG Nombre  TO \Archivo\Curarte\TemPlant.Cdx     
SET ORDER TO TAG Nombre

dbSelectArea("DetPlant")
dbSeek( cConc )
while !eof()
   
   if DetPlant->Plantilla  # cConc
      dbSkip()
      loop
   endif
   
   Plantilla->( dbSeek( DetPlant->Plantilla ) )

   if DetPlant->Via  = 1
      cVia := "Oral"
   elseif DetPlant->Via  = 2
          cVia := "IntraMuscular"
   elseif DetPlant->Via  = 3
          cVia := "SubCutanea"
   else
      cVia := "            "
   endif		  

   dbSelectArea("TemPlant")
   Amplia( 5, "TemPlant", cQuien )
   TemPlant->E           := if( DetPlant->Codigo = space(7), "*", " " )
   TemPlant->Historia    := Registro->Historia
   TemPlant->Registro    := Registro->Registro
   TemPlant->Fecha       := Registro->Fecha
   TemPlant->Codigo      := DetPlant->Codigo
   TemPlant->Servicio    := DetPlant->Servicio
   TemPlant->Nombre      := if( DetPlant->Codigo = space(7), "*****  ", "" ) + ALLTRIM(DetPlant->Nombre ) + if( DetPlant->Codigo = space(7), "  *****", "" )
   TemPlant->Prescribe   := DetPlant->Prescribe
   TemPlant->Via         := cVia
   TemPlant->Cantidad    := DetPlant->Cantidad
   dbUnlock()
   
   aadd( aPlant, { .f., DetPlant->Nombre, DetPlant->Prescribe, cVia, DetPlant->Cantidad } )
   aadd( aPide, { .f., DetPlant->Nombre, DetPlant->Prescribe, cVia, DetPlant->Cantidad, Registro->Historia, Registro->Registro, Registro->Fecha, Plantilla->Codigo } )
   
   dbSelectArea("DetPlant")
   dbSkip()
end do   

dbSelectArea("TemPlant")
dbGotop()
W_Imp1.Grid_P1.Refresh

Return NIL
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._


De antemano gracias por la ayuda... me es urgente, gracias



-----------------------------------
Hola !

Me pueden ayudar justo me pasa l mismo que a Gabriel, tengo un grid que no me muestra los datos ...
alguna sugerencia ?

De antemano mil gracias !
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Problema con Grid

Post by srvet_claudio »

Con bases de datos usar DYNAMICDISPLAY en lugar de COLUMNCONTROLS
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Izdeo
Posts: 17
Joined: Sat Jun 28, 2014 7:17 am

Post by Izdeo »

.
Last edited by Izdeo on Thu May 28, 2015 6:47 pm, edited 3 times in total.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Problema con Grid

Post by esgici »

danielmaximiliano wrote:Hola Gabriel :
a simple vista no veo errores en tu codigo, pero sin los datos de la tabla va a ser dificil comprobar el funcionamiento del mismo.
Google wrote:at first glance I do not see errors in your code, but without the data of the table will be difficult to check the operation.
+1

http://www.sindominio.net/ayuda/pregunt ... entes.html

http://www.catb.org/esr/faqs/smart-questions.html

Viva HMG :D
Viva INTERNATIONAL HMG :D
gabrieloq
Posts: 46
Joined: Thu Jan 24, 2013 9:45 pm
Location: Bucaramanga

Re: Problema con Grid

Post by gabrieloq »

Encontre el Error, previo a este grid existe un calculo que si el denominador es cero produce este error en los grid , lo mismo pasa si uno usa archivos temporales le da zap y posteriormente le da unn refresh produce error en el grid
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Problema con Grid

Post by Pablo César »

Hola Gabriel,

Puedes informarnos cual es el mensaje de error y de gran ayuda seria que prepares un corto ejemplo de los que mencionas.
Talvez asi consigamos antecipar este error que mencionas.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply