1. RE: Win32: number to text box
Hi,
Try:
setText(tboxOut, sprint(answer1) )
>From the reference manual:
Syntax: include misc.e
s = sprint(x)
Description: The representation of x as a string of characters is
returned. This is exactly the same as print(fn, x), except that the
output is returned as a sequence of characters, rather than being sent
to a file or device. x can be any Euphoria object.
Comments: The atoms contained within x will be displayed to a maximum of
10 significant digits, just as with print().
Example 1:
s = sprint(12345)
-- s is "12345"
Example 2:
s = sprint({10,20,30}+5)
-- s is "{15,25,35}"
Sim wrote:
> Hello,
> Yesterday, I asked how to convert a number from a textbox (SLE) to
> an atom. I followed Dan Moyer's adviced and used value(). (I'm creating
>
> a calculator using the Win32Lib.ew.) Now that I have computed a
> numerical number, I need to convert the number/atom into a string/text
> and then output that string/text to a textbox (SLE). I haven't found
> any library functions that can help me with the conversion.
> Anyone have any ideas?
>
> This is part of the error message I got when I tried to multiply 5 with
> 6 and then put the answer (30) in a text box (SLE):
>
> D:\EUPHORIA\include\Win32lib.ew:6865 in procedure setText()
> type_check failure, s is 25
> pID = 7
> s = 25
> ptr = <no value>
> result = <no value>
> id = <no value>
> lPart = <no value>
>
>
> If s is a sequence/string, then shouldn't "s" be displayed in the
> textbox when I use setText()?
>
>
> Here is the code:
>
>
> atom answer1, num1, num2
>
> --... some other code that works
>
> answer1 = num1 * num2
> setText(tboxOut, answer1)
>
>
> I tried declaring "answer1" as a sequence, but when I clicked the
> button, the textbox was cleared for some odd reason.
>
> My appologies if you are not used to the naming conventions I've
> used: I'm used to using Visual Basic and Window's naming convention.
>
> Thanks,
> Sim
>
>