TextBox DataType Numeric Vacio

HMG en Español

Moderator: Rathinagiri

Post Reply
Alepts
Posts: 9
Joined: Thu Feb 18, 2016 5:01 am

TextBox DataType Numeric Vacio

Post by Alepts »

Tengo un txt tipo numerico que al iniciar la aplicacion esta vacio, eso esta bien.
Agrege un boton para limpiar el formulario pero no se como dejarlo vacio
Intente esto

Code: Select all

Main.txt_Sector.Value := ''
Main.txt_Sector.Value := Nil
User avatar
ndarz
Posts: 56
Joined: Thu Apr 23, 2015 12:29 pm
Location: Argentina

Re: TextBox DataType Numeric Vacio

Post by ndarz »

Hola amigo, no se entiende bien cual es tu problema.

Tal vez si amplias un poco, o colocas un ejemplo real ( parte del codigo que no te funciona ), alguien pueda ayudarte.
Alepts
Posts: 9
Joined: Thu Feb 18, 2016 5:01 am

Re: TextBox DataType Numeric Vacio

Post by Alepts »

Lo que busco es que un textbox tipo Numérico quede vacío, si pongo Main.txt_Sector.Value := 0 obviamente se muestra el 0.
Si intento Main.txt_Sector.Value := "" por las comillas es tipo Carácter y el texbox al ser de tipo Numérico da error, lo mismo sucede con Main.txt_Sector.Value := nil
User avatar
pctoledo
Posts: 123
Joined: Wed Aug 25, 2010 10:45 am
Location: Araçatuba - SP - Brazil
Contact:

Re: TextBox DataType Numeric Vacio

Post by pctoledo »

Code: Select all

#include "hmg.ch"

Function Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 320 HEIGHT 200 ;
		TITLE 'TextBox Vacio' ;
		MAIN 

		@ 10,10 TEXTBOX Text_1 ;
			VALUE 123 ;
			TOOLTIP 'Numeric TextBox' ;
			NUMERIC ;
			MAXLENGTH 5 ;
			RIGHTALIGN

		DEFINE BUTTON C
			ROW	60
			COL	80
			WIDTH	160
			CAPTION	'Set Text_1 Vacio'
			ACTION	TxtVacio()
		END BUTTON

	END WINDOW

	Form_1.Center

	Form_1.Activate

Return Nil

Func TxtVacio()
Local nControlHandle:=GetControlHandle("Text_1","Form_1")
SetWindowText ( nControlHandle , "" )
Return Nil
Regards/Saludos,

Toledo

Clipper On Line
Alepts
Posts: 9
Joined: Thu Feb 18, 2016 5:01 am

Re: TextBox DataType Numeric Vacio

Post by Alepts »

Gracias pctoledo, me sirvió tu código.
Post Reply