Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Format mask to hide decimals
Message
De
21/04/2010 08:01:35
 
 
À
21/04/2010 07:34:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01460944
Message ID:
01461289
Vues:
47
Thanks Fabio.


>>Hi All,
>>
>>Is there a format mask I can use in a grid that will hide the decimal portion of numerics if they are all zero?
>>
>>Thanks
>
>This works ... but you can see a bug InputMask than spaces to align the decimal point
>
>Similarly a bug prevents operation when Sparse it is false.
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>DEFINE CLASS form1 AS form
>
>
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		ColumnCount = 1, ;
>		Height = 200, ;
>		Left = 24, ;
>		Panel = 1, ;
>		Top = 24, ;
>		Width = 320, ;
>		Name = "Grid1", ;
>		Column1.FontName = "Courier New", ;
>		Column1.Width = 172, ;
>		Column1.DynamicInputMask = "IIF(EMPTY(XX.AA%1),'9999   ','9999.99')", ;
>		Column1.Name = "Column1"
>
>	PROCEDURE Load
>		CREATE CURSOR XX (AA N(8,2))
>		INSERT INTO XX VALUES (1.34)
>		INSERT INTO XX VALUES (4.00)
>		INSERT INTO XX VALUES (-11.56)
>		INSERT INTO XX VALUES (1.00)
>		INSERT INTO XX VALUES (2.56)
>		INSERT INTO XX VALUES (23.00)
>		LOCATE
>	ENDPROC
>
>
>ENDDEFINE
>
>
>A solution exists with DynamicCurrentControl
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>DEFINE CLASS form1 AS form
>
>
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		ColumnCount = 1, ;
>		Height = 200, ;
>		Left = 24, ;
>		Panel = 1, ;
>		Top = 24, ;
>		Width = 320, ;
>		Name = "Grid1", ;
>		Column1.Width = 172, ;
>		Column1.Sparse = .F., ;
>		Column1.DynamicCurrentControl = "IIF(EMPTY(XX.AA%1),'Text1','Text2')"
>
>	PROCEDURE Load
>		CREATE CURSOR XX (AA N(8,2))
>		INSERT INTO XX VALUES (1.34)
>		INSERT INTO XX VALUES (4.00)
>		INSERT INTO XX VALUES (-11.56)
>		INSERT INTO XX VALUES (1.00)
>		INSERT INTO XX VALUES (2.56)
>		INSERT INTO XX VALUES (23.00)
>		LOCATE
>	ENDPROC
>
>
>	PROCEDURE grid1.Column1.Init
>		this.AddObject('Text2','TextBox')
>		this.Text2.Visible = .T.
>		this.Text1.InputMask = "9999   "
>		this.Text2.InputMask = "9999.99"
>		this.FontName = "Courier New"
>		this.DynamicCurrentControl = "IIF(EMPTY(XX.AA%1),'Text1','Text2')"
>
>	ENDPROC
>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform