losing last digit while pasting in grid 
Author Message
 losing last digit while pasting in grid

Hi Sir,
in a grid with a data type of currency and
format "999,999.99" in VFOX7

while running the grid, and COPYing and PASTING
one cell to another,

{ctrl-c} 50.34
{ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
                  ->{tab}     -> 50.34 (correct)

so can anyone how to get the correct answer by
using {enter}



Sun, 04 Sep 2005 12:45:30 GMT  
 losing last digit while pasting in grid
Hi johan,

this is another bad choice ( from VFP3 ) done by FOX Team.

If you paste on Textbox or EditBox, Text is filled from
Left to Right ( as typing on keyboard),
if last Text position is caught up, the last Text
character is rewritten until ClipText string is completed,
the last character of ClipText is put on last character of
textBox, the inner characters in excess are lost!

critical example code ( moneies !!!! )

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

        ADD OBJECT text1 AS textbox WITH ;
                Value = $0, ;
                InputMask = "9999.99", ;
                Left = 100, ;
                Top = 50

        PROCEDURE Click
                _CLIPTEXT='1234.1289' && from Excel CTRL-
C ?
                KEYBOARD '{CTRL+V}' PLAIN
        ENDPROC

ENDDEFINE

Click on form.
Result 1234.19 !!!!

I expected 1234.12 ( or 1234.13 ).

This problem occur also on keyboard typing !!!!

In order to resolve it, you must intercept the event
keypress (can use NODEF for the cut inner code of VFP).

Truly annoying !

The correct choice (for me) is to interrupt the insertion
of characters. But VFP5, vfp6, vfp7, vfp8 have been
produced and null it is changed.

You control if you have spaces on right 50.34.

Fabio

Quote:
>-----Original Message-----
>Hi Sir,
>in a grid with a data type of currency and
>format "999,999.99" in VFOX7

>while running the grid, and COPYing and PASTING
>one cell to another,

>{ctrl-c} 50.34
>{ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
>                  ->{tab}     -> 50.34 (correct)

>so can anyone how to get the correct answer by
>using {enter}
>.



Sun, 04 Sep 2005 18:04:08 GMT  
 losing last digit while pasting in grid
Fabio has outlined the problem.

Your best bet is to have either a RightClick method for the textbox, or a
button to the side of the textbox.

Method code

RightClick

this.value = val(_cliptext)

Button.click

this.parent.text1.value = val(_cliptext)

Andrew R.


Quote:
> Hi Sir,
> in a grid with a data type of currency and
> format "999,999.99" in VFOX7

> while running the grid, and COPYing and PASTING
> one cell to another,

> {ctrl-c} 50.34
> {ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
>                   ->{tab}     -> 50.34 (correct)

> so can anyone how to get the correct answer by
> using {enter}



Sun, 04 Sep 2005 19:25:55 GMT  
 losing last digit while pasting in grid
Hi Fabio
Using VFP8 I get 1234.12
-Anders


Quote:
> Hi johan,

> this is another bad choice ( from VFP3 ) done by FOX Team.

> If you paste on Textbox or EditBox, Text is filled from
> Left to Right ( as typing on keyboard),
> if last Text position is caught up, the last Text
> character is rewritten until ClipText string is completed,
> the last character of ClipText is put on last character of
> textBox, the inner characters in excess are lost!

> critical example code ( moneies !!!! )

> PUBLIC oform1

> oform1=NEWOBJECT("form1")
> oform1.Show
> RETURN

> DEFINE CLASS form1 AS form

> ADD OBJECT text1 AS textbox WITH ;
> Value = $0, ;
> InputMask = "9999.99", ;
> Left = 100, ;
> Top = 50

> PROCEDURE Click
> _CLIPTEXT='1234.1289' && from Excel CTRL-
> C ?
> KEYBOARD '{CTRL+V}' PLAIN
> ENDPROC

> ENDDEFINE

> Click on form.
> Result 1234.19 !!!!

> I expected 1234.12 ( or 1234.13 ).

> This problem occur also on keyboard typing !!!!

> In order to resolve it, you must intercept the event
> keypress (can use NODEF for the cut inner code of VFP).

> Truly annoying !

> The correct choice (for me) is to interrupt the insertion
> of characters. But VFP5, vfp6, vfp7, vfp8 have been
> produced and null it is changed.

> You control if you have spaces on right 50.34.

> Fabio

> >-----Original Message-----
> >Hi Sir,
> >in a grid with a data type of currency and
> >format "999,999.99" in VFOX7

> >while running the grid, and COPYing and PASTING
> >one cell to another,

> >{ctrl-c} 50.34
> >{ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
> >                  ->{tab}     -> 50.34 (correct)

> >so can anyone how to get the correct answer by
> >using {enter}
> >.



Sun, 04 Sep 2005 21:52:19 GMT  
 losing last digit while pasting in grid
I clicked on the form and also got 1234.12. The cursor was between the
rightmost 1 and 2.

However, I clicked on the form a second time and got 1234.11 with the cursor
between the two 1's.

--
Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

http://msdn.microsoft.com/vfoxpro  http://foxcentral.net


Quote:
> Hi Fabio
> Using VFP8 I get 1234.12
> -Anders



> > PUBLIC oform1

> > oform1=NEWOBJECT("form1")
> > oform1.Show
> > RETURN

> > DEFINE CLASS form1 AS form

> > ADD OBJECT text1 AS textbox WITH ;
> > Value = $0, ;
> > InputMask = "9999.99", ;
> > Left = 100, ;
> > Top = 50

> > PROCEDURE Click
> > _CLIPTEXT='1234.1289' && from Excel CTRL-
> > C ?
> > KEYBOARD '{CTRL+V}' PLAIN
> > ENDPROC

> > ENDDEFINE

> > Click on form.
> > Result 1234.19 !!!!



Mon, 05 Sep 2005 10:50:31 GMT  
 losing last digit while pasting in grid
Hi Anders

You have SET CONFIRM OFF.

You use SET CONFIRM OFF ?

Fabio

Quote:
>-----Original Message-----
>Hi Fabio
>Using VFP8 I get 1234.12
>-Anders



>> Hi johan,

>> this is another bad choice ( from VFP3 ) done by FOX
Team.

>> If you paste on Textbox or EditBox, Text is filled from
>> Left to Right ( as typing on keyboard),
>> if last Text position is caught up, the last Text
>> character is rewritten until ClipText string is
completed,
>> the last character of ClipText is put on last character
of
>> textBox, the inner characters in excess are lost!

>> critical example code ( moneies !!!! )

>> PUBLIC oform1

>> oform1=NEWOBJECT("form1")
>> oform1.Show
>> RETURN

>> DEFINE CLASS form1 AS form

>> ADD OBJECT text1 AS textbox WITH ;
>> Value = $0, ;
>> InputMask = "9999.99", ;
>> Left = 100, ;
>> Top = 50

>> PROCEDURE Click
>> _CLIPTEXT='1234.1289' && from Excel CTRL-
>> C ?
>> KEYBOARD '{CTRL+V}' PLAIN
>> ENDPROC

>> ENDDEFINE

>> Click on form.
>> Result 1234.19 !!!!

>> I expected 1234.12 ( or 1234.13 ).

>> This problem occur also on keyboard typing !!!!

>> In order to resolve it, you must intercept the event
>> keypress (can use NODEF for the cut inner code of VFP).

>> Truly annoying !

>> The correct choice (for me) is to interrupt the
insertion
>> of characters. But VFP5, vfp6, vfp7, vfp8 have been
>> produced and null it is changed.

>> You control if you have spaces on right 50.34.

>> Fabio

>> >-----Original Message-----
>> >Hi Sir,
>> >in a grid with a data type of currency and
>> >format "999,999.99" in VFOX7

>> >while running the grid, and COPYing and PASTING
>> >one cell to another,

>> >{ctrl-c} 50.34
>> >{ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
>> >                  ->{tab}     -> 50.34 (correct)

>> >so can anyone how to get the correct answer by
>> >using {enter}
>> >.

>.



Mon, 05 Sep 2005 17:45:38 GMT  
 losing last digit while pasting in grid
Hi Cindy,

1. You have SET CONFIRM OFF
2. Pastes start at SelStart (are one chosen)

3. An other problem of the .SelStart property:  

- SelStart changes if I make something on the textbox (is
an error)
 STORE T. TO textbox.FontBold
 STORE RGB(1,1,1) to textbox.foreColor
 .....  
all reset SelStart (Why ?)

3. Origin problem:
Example:
- Input Datetime textbox with .Text='01/01/ 16:48'
- press ENTER
- get .text='01/01/2016 00:48' ( the hours become years )

The VFP input parser use this rule:
 - removes the text internal spaces, with the rest tries
to gain a value coherent with the type of .Value.

All this happens from VFP3.

Fabio

Quote:
>-----Original Message-----
>I clicked on the form and also got 1234.12. The cursor
was between the
>rightmost 1 and 2.

>However, I clicked on the form a second time and got

1234.11 with the cursor
Quote:
>between the two 1's.

>--
>Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP


http://cindywinegarden.adsl.duke.edu
Quote:
>http://msdn.microsoft.com/vfoxpro  http://foxcentral.net



>> Hi Fabio
>> Using VFP8 I get 1234.12
>> -Anders



>> > PUBLIC oform1

>> > oform1=NEWOBJECT("form1")
>> > oform1.Show
>> > RETURN

>> > DEFINE CLASS form1 AS form

>> > ADD OBJECT text1 AS textbox WITH ;
>> > Value = $0, ;
>> > InputMask = "9999.99", ;
>> > Left = 100, ;
>> > Top = 50

>> > PROCEDURE Click
>> > _CLIPTEXT='1234.1289' && from Excel CTRL-
>> > C ?
>> > KEYBOARD '{CTRL+V}' PLAIN
>> > ENDPROC

>> > ENDDEFINE

>> > Click on form.
>> > Result 1234.19 !!!!

>.



Mon, 05 Sep 2005 18:05:27 GMT  
 losing last digit while pasting in grid
Always SET CONFIRM OFF.
With SET CONFIRM ON I see the what occurs in combination with the inputmask.
If you have an inputmask="9999.99" and Confirm is On and you then proceed to
type 1234.12 your input cursor will land between 1 and 2. If you continue
typing the additional digits will replace the 2 and you may end up with
1234.19. It's to be expected under the circumstances.
If the _cliptext is '1234.12'+chr(13)+'89' you'll get 1234.12 in the
textbox.

-Anders


Quote:
> Hi Anders

> You have SET CONFIRM OFF.

> You use SET CONFIRM OFF ?

> Fabio

> >-----Original Message-----
> >Hi Fabio
> >Using VFP8 I get 1234.12
> >-Anders



> >> Hi johan,

> >> this is another bad choice ( from VFP3 ) done by FOX
> Team.

> >> If you paste on Textbox or EditBox, Text is filled from
> >> Left to Right ( as typing on keyboard),
> >> if last Text position is caught up, the last Text
> >> character is rewritten until ClipText string is
> completed,
> >> the last character of ClipText is put on last character
> of
> >> textBox, the inner characters in excess are lost!

> >> critical example code ( moneies !!!! )

> >> PUBLIC oform1

> >> oform1=NEWOBJECT("form1")
> >> oform1.Show
> >> RETURN

> >> DEFINE CLASS form1 AS form

> >> ADD OBJECT text1 AS textbox WITH ;
> >> Value = $0, ;
> >> InputMask = "9999.99", ;
> >> Left = 100, ;
> >> Top = 50

> >> PROCEDURE Click
> >> _CLIPTEXT='1234.1289' && from Excel CTRL-
> >> C ?
> >> KEYBOARD '{CTRL+V}' PLAIN
> >> ENDPROC

> >> ENDDEFINE

> >> Click on form.
> >> Result 1234.19 !!!!

> >> I expected 1234.12 ( or 1234.13 ).

> >> This problem occur also on keyboard typing !!!!

> >> In order to resolve it, you must intercept the event
> >> keypress (can use NODEF for the cut inner code of VFP).

> >> Truly annoying !

> >> The correct choice (for me) is to interrupt the
> insertion
> >> of characters. But VFP5, vfp6, vfp7, vfp8 have been
> >> produced and null it is changed.

> >> You control if you have spaces on right 50.34.

> >> Fabio

> >> >-----Original Message-----
> >> >Hi Sir,
> >> >in a grid with a data type of currency and
> >> >format "999,999.99" in VFOX7

> >> >while running the grid, and COPYing and PASTING
> >> >one cell to another,

> >> >{ctrl-c} 50.34
> >> >{ctrl-v} 50.3|4   ->{enter}   -> 50.30 (wrong)
> >> >                  ->{tab}     -> 50.34 (correct)

> >> >so can anyone how to get the correct answer by
> >> >using {enter}
> >> >.

> >.



Mon, 05 Sep 2005 20:46:30 GMT  
 losing last digit while pasting in grid
That would be because the next time 1234.1289 is inserted it's inserted at
the cursor poition.
-Anders


Quote:
> I clicked on the form and also got 1234.12. The cursor was between the
> rightmost 1 and 2.

> However, I clicked on the form a second time and got 1234.11 with the
cursor
> between the two 1's.

> --
> Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

> http://msdn.microsoft.com/vfoxpro  http://foxcentral.net



> > Hi Fabio
> > Using VFP8 I get 1234.12
> > -Anders



> > > PUBLIC oform1

> > > oform1=NEWOBJECT("form1")
> > > oform1.Show
> > > RETURN

> > > DEFINE CLASS form1 AS form

> > > ADD OBJECT text1 AS textbox WITH ;
> > > Value = $0, ;
> > > InputMask = "9999.99", ;
> > > Left = 100, ;
> > > Top = 50

> > > PROCEDURE Click
> > > _CLIPTEXT='1234.1289' && from Excel CTRL-
> > > C ?
> > > KEYBOARD '{CTRL+V}' PLAIN
> > > ENDPROC

> > > ENDDEFINE

> > > Click on form.
> > > Result 1234.19 !!!!



Mon, 05 Sep 2005 20:20:25 GMT  
 losing last digit while pasting in grid
Hi Fabio

The separator character in a date entry is optional and can be mixed freely
as one or more spaces or a single  - or . or /

? {^2003 /02-23}
? {^2003.2/23}
? {^2003 2    23}
all return the same value
How is the parser to understand that you forgot to enter a year in '01/01/
16:48'
? I would think this could be handled in a textbox with StrictDa{*filter*}try=0
and checking and parsing This.text in the Valid. Messagebox('What is this
supposed to be?'). A control like the DateTimePicker rules out ambiguous
date entries.

Once you know that switching font values affects the input position in a
live textbox you can just save and restore SelStart. That's why it's there,
My answer to 'Why' in this case is 'So what?'
The fact should be perhaps need to be documented.

You should try and distinguish among errors, grading from 'serious' to 'nit'
, anomalies, undocumented bad behavior, undocumented good behavior, and
undocumented but probably 'by design' behavior.

-Anders


Quote:
> Hi Cindy,

> 1. You have SET CONFIRM OFF
> 2. Pastes start at SelStart (are one chosen)

> 3. An other problem of the .SelStart property:

> - SelStart changes if I make something on the textbox (is
> an error)
>  STORE T. TO textbox.FontBold
>  STORE RGB(1,1,1) to textbox.foreColor
>  .....
> all reset SelStart (Why ?)

> 3. Origin problem:
> Example:
> - Input Datetime textbox with .Text='01/01/ 16:48'
> - press ENTER
> - get .text='01/01/2016 00:48' ( the hours become years )

> The VFP input parser use this rule:
>  - removes the text internal spaces, with the rest tries
> to gain a value coherent with the type of .Value.

> All this happens from VFP3.

> Fabio

> >-----Original Message-----
> >I clicked on the form and also got 1234.12. The cursor
> was between the
> >rightmost 1 and 2.

> >However, I clicked on the form a second time and got
> 1234.11 with the cursor
> >between the two 1's.

> >--
> >Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

> http://www.*-*-*.com/
> > http://www.*-*-*.com/ ; http://www.*-*-*.com/



> >> Hi Fabio
> >> Using VFP8 I get 1234.12
> >> -Anders



> >> > PUBLIC oform1

> >> > oform1=NEWOBJECT("form1")
> >> > oform1.Show
> >> > RETURN

> >> > DEFINE CLASS form1 AS form

> >> > ADD OBJECT text1 AS textbox WITH ;
> >> > Value = $0, ;
> >> > InputMask = "9999.99", ;
> >> > Left = 100, ;
> >> > Top = 50

> >> > PROCEDURE Click
> >> > _CLIPTEXT='1234.1289' && from Excel CTRL-
> >> > C ?
> >> > KEYBOARD '{CTRL+V}' PLAIN
> >> > ENDPROC

> >> > ENDDEFINE

> >> > Click on form.
> >> > Result 1234.19 !!!!

> >.



Mon, 05 Sep 2005 22:30:15 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Losing Changes Since Last Save when clicking Save

2. Utility to convert 2 digit year text boxes into 4 year digit text boxes

3. Focusing the last rec. in grid

4. how to Highlight the last row in grid

5. copy and paste in a grid?

6. Diplaying the LAST Item in a grid.

7. Click event not seen by last grid row?

8. sorry for goofy name on last post -- Help w/ grids -- New to VFP

9. grid control: can i cut and paste columns?

10. Detecting Last Line Of A Grid (VFP6SP3)

11. Grid - Last row

12. Displaying the last n records in a grid

 

 
Powered by phpBB® Forum Software