FoxPro/Visual FoxPro - Ayuda con Báscula

 
Vista:
sin imagen de perfil

Ayuda con Báscula

Publicado por Ninho (2 intervenciones) el 20/04/2018 19:37:22
Buen día.

Utilizo VFP9 SP2. Estoy trabajando en un punto de venta donde ahora tengo conectada una bascula; quiero que lea el peso y lo ponga en un text. He investigado, y pude leer el peso, pero no logro poner el valor correctamente en el text. Sin embargo con la MESSAGEBOX si me pone el peso correcto ¿Cómo le haga para poner el peso correcto en el text? o bien, ¿puede extraer el valor de la MESSAGEBOX?. Pego el codigo y adjunto imagenes y form de lo que les comparto. Pido su ayuda con esto por favor.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
*LPARAMETERS oObject
*oObject=thisform
LOCAL cRETORNO,nPOSICION,nRETORNO,cKILOS,cGRAMOS,nveces
	nVeces=1
	SET DECIMALS TO 3
	cRETORNO=""
	nRETORNO=0
	thisform.oleBASCULA.SETTINGS="9600,n,8,1"
	thisform.oleBASCULA.COMMPORT=6
	thisform.oleBASCULA.InputLen=8
	thisform.oleBASCULA.Inputmode=0
	thisform.oleBASCULA.handshaking=0
 
	DO WHILE nVECES<4
		If thisform.oleBASCULA.PortOpen = .f.
			thisform.oleBASCULA.PortOpen = .t.
			thisform.oleBASCULA.OUTPUT=CHR(80)
		ENDIF
		nVECES=nVECES+1
		*** ESPERA
		WAIT "...ESPERANDO PESO..." WINDOWS TIMEOUT 0.3
		**********
 
			cRETORNO=alltrim(thisform.oleBASCULA.Input)
			thisform.txtpeso.value=transform(nRETORNO)
			MESSAGEBOX("peso: "+transform(cRETORNO))
			*thisform.txtpeso.value=transform(nRETORNO)
			thisform.oleBASCULA.PortOpen = .f.
			EXIT
 
			If thisform.oleBASCULA.PortOpen = .T.
				thisform.oleBASCULA.PortOpen = .F.
			ENDIF
 
	ENDDO
	IF !EMPTY(cRETORNO)
		SET POINT TO "."
		nRETORNO=VAL(cRETORNO)
		SET POINT TO ","
	ENDIF
	*SET DECIMALS TO OAPP.NDECIMALES
 
	*thisform.txtpeso.value=transform(nRETORNO)
RETURN (nRETORNO)
bascula
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 59
Ha disminuido 1 puesto en FoxPro/Visual FoxPro (en relación al último mes)
Gráfica de FoxPro/Visual FoxPro

Ayuda con Báscula

Publicado por Juan (114 intervenciones) el 23/04/2018 18:28:58
Buenas Ninho

Has probado a poner thisform.txtpeso.value=transform(cRETORNO), es que tienes con nRETORNO

Un saludo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar