Page 1 of 1

Message Box problem

Posted: Wed Feb 23, 2011 6:01 pm
by townsend
Here's the problem I'm having. Every time I execute a command in the Message Box,
only the last result is displayed. For instance:

Code: Select all

put "first line"
put "now second line"
displays only, "now second line" and NOT "first line".

I've been reading through the "Message box tips and Tricks" tutorial.
lessons_runrev_com/spaces/lessons/buckets/784/lessons/8537-Message-box-tips-and-tricks
(change both _ to .)

It says:
Control + a: shifts insert point to start of line
Control + n: shifts insert point to end of line
This should be the work, but it doesn't.

Also:
In multi-line message box mode Control + Up or Down key:
shifts insert point between the command editing area (top) and results area (bottom)
Which also doesn't work for me.
I'm probably just missing something simple.
This is on a Windows 7 machine.

Re: Message Box problem

Posted: Wed Feb 23, 2011 6:06 pm
by dunbarx
Hi. I am on a Mac, so I cannot comment on the navigation stuff.

But the action of the two commands seems normal to me. Try this:

put "first line"
wait 15
put "now second line"

See? The commands are executed as they should be, you just didn't see it in your version. And since the output is in the msg box itself, only the last command is seen, since the results of the first are overwritten.

Craig Newman

Re: Message Box problem

Posted: Wed Feb 23, 2011 6:16 pm
by townsend
Thanks Craig. Yes. I see the "first line" message, then it is overwritten.

So, that's the only way it works? I can't get both to appear? Like:

"first line"
"now second line"

I'm using LiveCode 4.5.3

Re: Message Box problem

Posted: Wed Feb 23, 2011 6:22 pm
by Klaus
Hi townsend,

hey, the thing in the messagebox is just a field :D, so try:
...
put "line 1"
put CR & "line 2" after msg
...
Works here!

A simpel "put xyz" will always overwrite the previous content!


Best

Klaus

Re: Message Box problem

Posted: Wed Feb 23, 2011 6:32 pm
by townsend
Craig-- that WAIT command is really good to know about.
That does get the job done.

But Klaus-- that AFTER MSG option is exactly what I was looking for.

Thanks guys! This is a great community!

Re: Message Box problem

Posted: Wed Feb 23, 2011 10:57 pm
by dunbarx
You are on your way.

Just note that the message box is usually just a scratch pad. So if you are just quickly testing a code segment or viewing a result, it is ideal. But I usually like to create a field to display stuff if I know that I will be fooling around for a while.

Just as in an ordinary field, if you want your output to be two distinct lines, you have to craft them that way. Klaus has shown you the method, and you should see its logic and simplicity. More important is that you see the logic of why only one line was written from your original attempt. It is because you wrote it that way. You would have had the same question for this forum if you had in fact used a field as your target container.

Keep coming back for more.