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
![Smile :)](./images/smilies/icon_e_smile.gif)
Moderator: Rathinagiri
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
you are talking about "bug" for a normal behavior.Rathi wrote:The numeric textbox accepts only numeric values. But clipboard text is character type