Guest
Hi guys,
I am new to Skill and I am making a program. First of all I've made a parameter in the CDF then I wanted to add to it a callback that verifies if it is a number first of all and then if it is odd. But i get some errors. If some of you can give me some hints it would be appreciated.
cdfCreateParam( cdfId
?name "p"
?prompt "Parametru"
?defValue "1"
?type "string"
?display "t"
?editable "t"
?callback "verify('p)"
?storeDefault "yes"
?parseAsNumber "yes"
?parseAsCEL "yes"
)
procedure(verify(p)
let((k text (buttons 'YesNo))
if(evalstring("p")!=nil then p=k && sprintf(text "Value is a number")
if(mod(k 2)==0 then sprintf(text "Valoarea is an even number")
else
sprintf(text "Value is not an even number")
else sprintf(text "This isn't a number")))status = hiDisplayAppDBox(
?name 'parameterCB
?dboxBanner "Parameter unit check"
?dboxText text
?dialogType hicQuestionDialog
?buttonLayout buttons
?defaultButton 1
)
)
)
And this is the error: *Error* mod: can't handle mod(nil 2)
I am new to Skill and I am making a program. First of all I've made a parameter in the CDF then I wanted to add to it a callback that verifies if it is a number first of all and then if it is odd. But i get some errors. If some of you can give me some hints it would be appreciated.
cdfCreateParam( cdfId
?name "p"
?prompt "Parametru"
?defValue "1"
?type "string"
?display "t"
?editable "t"
?callback "verify('p)"
?storeDefault "yes"
?parseAsNumber "yes"
?parseAsCEL "yes"
)
procedure(verify(p)
let((k text (buttons 'YesNo))
if(evalstring("p")!=nil then p=k && sprintf(text "Value is a number")
if(mod(k 2)==0 then sprintf(text "Valoarea is an even number")
else
sprintf(text "Value is not an even number")
else sprintf(text "This isn't a number")))status = hiDisplayAppDBox(
?name 'parameterCB
?dboxBanner "Parameter unit check"
?dboxText text
?dialogType hicQuestionDialog
?buttonLayout buttons
?defaultButton 1
)
)
)
And this is the error: *Error* mod: can't handle mod(nil 2)