1. setText with line feed

Hi everyone,

I'm new to the list (been watching for a couple of days) and also new to
Euphoria so please accept my apologies in advance for my ignorance..

This is the scenario:

In a Windows gui using Win32lib.ew (thanks David) I have a single line text
box which a user enters a command. After pressing <enter> a predetermined
result is dumped to a multi line text box. I require this dump to be on
multiple lines with predetermined carriage returns.

I'm currently using setText(MLEControl,string). When I add a {13} in the
middle of the string I get a system character inserted. When I try and add
a "\n" in the string I get the error: "sequence to be poked must only
contain atoms", from machine.e, allocate_string().

Questions?
- How can I achieve what I want to do and is there a better way?
- My ideal solution would be a window with a prompt that a user can type
into and see the output and be sitting at the prompt again. (ie it keeps
scrolling sort of like MS Terminal).

Any solutions, direction or help would be greatly appreciated.

Thanks in advance,

Greg Viger.

new topic     » topic index » view message » categorize

2. Re: setText with line feed

Greg Viger wrote:

>[snip] When I add a {13} in the
>middle of the string I get a system character inserted. When I try and add
>a "\n" in the string I get the error: "sequence to be poked must only
>contain atoms", from machine.e, allocate_string().

Your problem stems from the fact that you are putting length-1 sequences
("\n") into a sequence, rather than atom values ('\n').

"\n" = {10}
'\n' = 10
"\r" = {13}
'\r' = 13

Section 2.1.2 ("Character Strings and Individual Characters") of REFMAN.DOC
deals with the differences between single-quoted and double-quoted chars.


Hope this helps,
   Gabriel Boehme

new topic     » goto parent     » topic index » view message » categorize

3. Re: setText with line feed

Gabriel,

        By making sure I put in atoms I don't get the error. However, I still
don't get a line feed. Instead where the line feed should be I get a system
key (ie little black box). It's as if the setText procedure isn't
interpreting the code and instead is passing it directly as a key. Looking
at David's setText it calls allocate_string which is an Euphoria system
command. Does allocate_string not look at the system codes? Does anyone
know a way around this?

Thanks.
Greg Viger.

-----Original Message-----
From:   Boehme, Gabriel [SMTP:gboehme at POBOXB1.HQ.MSMAIL.MUSICLAND.COM]
Sent:   Thursday, July 29, 1999 6:01 PM
To:     EUPHORIA at LISTSERV.MUOHIO.EDU
Subject:        Re: setText with line feed

Greg Viger wrote:

>[snip] When I add a {13} in the
>middle of the string I get a system character inserted. When I try and add
>a "\n" in the string I get the error: "sequence to be poked must only
>contain atoms", from machine.e, allocate_string().

Your problem stems from the fact that you are putting length-1 sequences
("\n") into a sequence, rather than atom values ('\n').

"\n" = {10}
'\n' = 10
"\r" = {13}
'\r' = 13

Section 2.1.2 ("Character Strings and Individual Characters") of REFMAN.DOC
deals with the differences between single-quoted and double-quoted chars.


Hope this helps,
   Gabriel Boehme

new topic     » goto parent     » topic index » view message » categorize

4. Re: setText with line feed

Try using sprintf to format before you make it into a string.
Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu