Hello Roberto,
I found problem when I am trying to paste numeric data with decimal point into a numeric text box having decimal point (eg., 999999.9999)
Is there any solution?
Thanks in advance
Pasting Problem with Numeric Textbox
Moderator: Rathinagiri
Pasting Problem with Numeric Textbox
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Pasting Problem with Numeric Textbox
Hi Sudip
Added a second label-textbox pair to your code for showing how work copy-paste.
Please try and decide your-self this is a bug or not.
Regards
--
Esgici
Added a second label-textbox pair to your code for showing how work copy-paste.
Please try and decide your-self this is a bug or not.
Code: Select all
function CalcBasic()
local mRow := 0
private isinit := .f.
if isWindowDefined(CalcBasic)
domethod("calcbasic", "setfocus")
return nil
endif
DEFINE WINDOW calcbasic ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 300 ;
TITLE 'Calculate basic rate from net rate after VAT' ;
MODAL
mrow := 10
define label netratelabel
row mrow
col 20
value "Net Rate:"
end label
define textbox netrate
row mrow
col 170
datatype numeric
value 1.1
inputmask "99999.9999"
width 100
onchange calc_basic()
end textbox
mrow += 30
define label vatratelabel
row mrow
col 20
value "VAT %:"
end label
define textbox vatrate
row mrow
col 170
datatype numeric
value 2.2
inputmask "99.99"
width 50
onchange calc_basic()
end textbox
define label label1
row mrow
col 225
value "%"
end label
mrow += 30
define label rofflabel
row mrow
col 20
value "Decimal Pt.:"
end label
define spinner roff
row mrow
col 170
width 40
rangemax 4
rangemin 0
value 4
onchange calc_basic()
end spinner
mrow += 30
define label basicratelabel
row mrow
col 20
value "Basic Rate:"
end label
define label basicrate
row mrow
col 170
width 100
alignment right
fontbold .t.
end label
mrow += 30
define label lblPasted
row mrow
col 20
width 150
alignment left
fontbold .t.
Value "'Paste' button for paste :"
end label
define textbox txbPasted
row mrow
col 170
width 100
datatype numeric
inputmask "99.9999"
end textbox
mrow += 30
define label lblPasted2
row mrow
col 20
width 120
alignment left
fontbold .t.
Value "Shift+Ins for paste"
end label
define textbox txbPasted2
row mrow
col 170
width 100
end textbox
mrow += 50
define button copy
row mrow
col 70
width 120
caption "&Copy to Clipboard"
action {|| System.clipboard := calcbasic.basicrate.value }
end button
define button paste
row mrow
col 200
width 120
caption "&Past from Clipboard"
action ( calcbasic.txbPasted.value := VAL( System.clipboard ) ) // PasteValue()
end button
END WINDOW
isinit := .t.
ON KEY ESCAPE OF calcbasic ACTION calcbasic.release()
CENTER WINDOW calcbasic
ACTIVATE WINDOW calcbasic
RETURN
static function Calc_basic()
if !isinit
return nil
endif
calcbasic.txbPasted.value := 0
calcbasic.basicrate.value := str(round((calcbasic.netrate.value*100)/(100+calcbasic.vatrate.value), ;
calcbasic.roff.value))
return nil
--
Esgici
Viva INTERNATIONAL HMG
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Pasting Problem with Numeric Textbox
I noticed after sent my previous post that you are talk to Roberto.
Sorry if my response disturbed you.
Regards
--
Esgici
Sorry if my response disturbed you.
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Pasting Problem with Numeric Textbox
Hello Brother Esgici,
I am very much happy to talk to you
Thanks a lot for your help. It works fine.
But, I found problem with common copy-and-paste using Ctrl+V, not by using value property of numeric textbox.
How I tested:
1. Copy (using Ctrl+C or System.clipboard := ...) any numerical value (eg., 88,89) to clipboard from anywhere (eg., from Notepad).
2. Now set focus to any of your existing app's numeric textbox control having decimal point picture, eg., "999999.9999".
3. Now use Ctrl+V to paste the value from windows clip board.
In my case, I found problem.
(I reported this problem in BUG Reports section, because I think it will be easier for Roberto to find it from here. As he is very busy, he may not have time to see the problem in Help Section, where I first asked help for this problem.)
I understand the code I posted in Help Section is mis-leading. Problem is general, not related to the specific code. Sorry
Thank you again for your help
I am very much happy to talk to you
Thanks a lot for your help. It works fine.
But, I found problem with common copy-and-paste using Ctrl+V, not by using value property of numeric textbox.
How I tested:
1. Copy (using Ctrl+C or System.clipboard := ...) any numerical value (eg., 88,89) to clipboard from anywhere (eg., from Notepad).
2. Now set focus to any of your existing app's numeric textbox control having decimal point picture, eg., "999999.9999".
3. Now use Ctrl+V to paste the value from windows clip board.
In my case, I found problem.
(I reported this problem in BUG Reports section, because I think it will be easier for Roberto to find it from here. As he is very busy, he may not have time to see the problem in Help Section, where I first asked help for this problem.)
I understand the code I posted in Help Section is mis-leading. Problem is general, not related to the specific code. Sorry
Thank you again for your help
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Pasting Problem with Numeric Textbox
Dear Sudip
Though our friend Rathi noticed already in respond to your previous topic,
If you want (manually or by code) "paste" a value form clipboard to any control, you need have a control accepting "char" type data.
If you want pasting by code, you can convert char type data to numeric by VAL() function ("txbPasted" in sample).
If you want your "invaluable" user have ability to pasting manually, you have give him/her a char type control ("txbPasted2" in sample) and later convert it to numeric any way you like.
I you want a text box for numeric data and accept char type data, you have write your own "wizard" control. No kidding, this is possible and probably not difficult, but in my opinion this will be an needless and confusing feature.
Sorry for my blab; you know old men talk much
Regards
--
Esgici
Though our friend Rathi noticed already in respond to your previous topic,
you are talking about "bug" for a normal behavior.Rathi wrote:The numeric textbox accepts only numeric values. But clipboard text is character type
If you want (manually or by code) "paste" a value form clipboard to any control, you need have a control accepting "char" type data.
If you want pasting by code, you can convert char type data to numeric by VAL() function ("txbPasted" in sample).
If you want your "invaluable" user have ability to pasting manually, you have give him/her a char type control ("txbPasted2" in sample) and later convert it to numeric any way you like.
I you want a text box for numeric data and accept char type data, you have write your own "wizard" control. No kidding, this is possible and probably not difficult, but in my opinion this will be an needless and confusing feature.
Sorry for my blab; you know old men talk much
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Pasting Problem with Numeric Textbox
Last edited by sudip on Thu Jul 15, 2010 2:34 pm, edited 4 times in total.
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Pasting Problem with Numeric Textbox
Viva INTERNATIONAL HMG