Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: sanjay karia
  Where is sanjay karia?
 mumbai
 India
 sanjay karia
 To: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 Tags
Subject: RE: Modify Value after Decimal in Grid
Thread ID: 268774 Message ID: 268825 # Views: 26 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Wednesday, July 14, 2010 8:50:29 PM         
   


Thanks Yousfi,

Regards

> > Hello friends,
> > My grid1.column1.text1 has value of 12345.678
> > Now what I want is, whenever the column1.text1 has got focus, the user can have the option of changing only decimal value. Say from 12345.678 to 12345.637.
> >
> > At present he is typing the whole value, I want to reduce this say for eg if he want to change only after decimal, if he press . , he should be able to change only decimal value.
> >
> > I tried (column1.text1.gotfocus),
> >
lvar = allt(str(int(.value)))+[.]
> > keyboard lvar
> > 

> > but this replaces the decimal value with .000
> >
> > how to do this?
> >
> > please advise
> > Thanks in advance
> >
> > Sanjay Karia.
>
>
> this can be done with bindevent and some keystrokes programmatly (note that selStart and sellength dont work in grid...)
>
>
> *!*-- Begin Code
> yform=createObject("asup")
> yform.show
> read events
> return
> 
> DEFINE CLASS asup AS form
> 	Height = 336
> 	Width = 226
> 	ShowWindow = 2
> 	DoCreate = .T.
> 	AutoCenter = .T.
> 	Caption = "Click..."
> 	AlwaysOnBottom = .T.
> 	Name = "Form1"
> 
> 	ADD OBJECT grid1 AS grid WITH ;
> 		DeleteMark = .F., ;
> 		HeaderHeight = 25, ;
> 		Height = 336, ;
> 		Left = 0, ;
> 		Top = 0, ;
> 		Width = 300, ;
> 		Name = "Grid1"
> 
> 	PROCEDURE my
> 		**create an array laEvents
> 		   Aevents( myArray, 0)
> 		* *calling object
> 		    loObject = myArray[1]
> 		
> 		KEYBOARD '{END}'
> 
> 		FOR i = 1 TO 2
> 		KEYBOARD '{LEFTARROW}'
> 		ENDFOR
> 		KEYBOARD '{SHIFT+END}'
> 	ENDPROC
> 
> 	PROCEDURE Load
> 		create cursor ycurs (myField n(10,3))
> 		for i=1 to 20
> 		insert into ycurs values(2*i+1245.356)
> 		endfor
> 		locate
> 	ENDPROC
> 
> 	PROCEDURE Init
> 		this.keyPreview=.t.
> 
> 		with this.grid1
> 		.recordsource="ycurs"
> 		.recordsourcetype=1
> 		.column1.width=200
> 		endwith
> 
> 		bindevent(this.grid1.column1.text1,"click",this,'my')  &&or dblclick...or keypress(keypreview=.t. mandatory)
> 	ENDPROC
> 
> PROCEDURE DESTROY
> CLEA EVENTS
> endproc
> 
> ENDDEFINE
> *
> *!*-- End Code
> 

>
> this code select the three last digits (after the decimal point) to replace manually.
> Also this can be done manually as identical by selecting a record pointing to the first digit after the decimal point and selectind three digit+then replacing.
>
> Regards
> Yousfi Benameur

ENTIRE THREAD

Modify Value after Decimal in Grid Posted by sanjay karia @ 7/14/2010 2:38:23 PM
RE: Modify Value after Decimal in Grid Posted by Koen Piller @ 7/14/2010 4:07:37 PM
RE: Modify Value after Decimal in Grid Posted by sanjay karia @ 7/14/2010 4:22:56 PM
RE: Modify Value after Decimal in Grid Posted by Anil Sharma @ 7/14/2010 5:36:47 PM
RE: Modify Value after Decimal in Grid Posted by sanjay karia @ 7/14/2010 8:49:17 PM
RE: Modify Value after Decimal in Grid Posted by Yousfi Benameur @ 7/14/2010 7:16:23 PM
RE: Modify Value after Decimal in Grid Posted by sanjay karia @ 7/14/2010 8:50:29 PM
RE: Modify Value after Decimal in Grid Posted by Koen Piller @ 7/14/2010 10:34:46 PM
RE: Modify Value after Decimal in Grid Posted by Yousfi Benameur @ 7/15/2010 12:41:24 AM