Message Path Question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Message Path Question

Post by FireWorx » Tue Sep 20, 2011 10:27 pm

Hi,
I have a complex script that sends a custom handler from an image or a background (doesn't seem to matter) to my card script. The handler was intercepted in the card script and executed no problem until I added a second card to the stack and now it can no longer find the handler in the card script. I moved the handler to the stack script and it finds it just fine.

Is there a way I can point the handler message to the card script of the card it sits on? Based on the documentation it seems like it should do that anyway. Is it because the card script is located on card #2 of the stack? Weird.

Dave

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Message Path Question

Post by mwieder » Tue Sep 20, 2011 11:01 pm

Dave - hard to tell too much from your description, but it sounds like that's the way things should work. You might look up currentcard in the documentation and see if that helps out. What mechanism are you using to "send a custom handler..."? You can use "send" to access handlers in another card, but from what you've written I think placing the handler in the stack script is the correct methodology.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Wed Sep 21, 2011 3:12 am

In the image background or button (i tried all three) I just say

on mouseUp
do UpToTheLeft
end mouseUp

Then in the card script I have a handler that says

UpToTheLeft
do this
do that
do the other thing
end UpToTheLeft

It worked great until I added a second card to the stack and now I have to move the UpToTheLeft handler to the stack script I guess? I don't want to leave the card because I have an open browser loading urls but I guess passing the message up to the stack and then repopulating the browser on the card won't be a problem.

I just added a splash card to the one main card in the stack that holds the browser and now all the scripts are bonking.

Dave

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Wed Sep 21, 2011 4:00 am

Its messed up. Now it can't find the handlers in the stack script either. not even from a button. Guess ll rewrite the stack into one huge huge script with a tons of replicated tasks. Pissed.
Dave

Dave

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Message Path Question

Post by WaltBrown » Wed Sep 21, 2011 4:55 am

Dave,
Have you tried "Dispatch", "Send", or "Call"? I'm not sure "Do" is the right command for calling a handler directly - it seems to be meant for calling a script whose text is in a container, like if "UpToTheLeft" was a variable containing the text of a script rather than a handler name.
Just a thought,
Walt
Walt Brown
Omnis traductor traditor

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Wed Sep 21, 2011 7:23 am

Thanks Walt,
I have been having a hard time with RunRev. I installed 4.6.4 today and the debugger stopped working so I reloaded 4.6.3. Then all the sudden the messages paths became an issue. Also noticed in the dictionary dark lines were drawn through the topics on the left as if by marker pen. I reloaded 4.6.4 again and moved some things around and it is working again. So crossing my fingers.
The do command does work as in do MySpecialFunction but I have had some issues with it too.
Dave

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Message Path Question

Post by Klaus » Wed Sep 21, 2011 12:29 pm

Hi Dave,

the message path is reliable, if used correctly, so please post (some of) your code,
we can't even guess from infos like: "...and now all the scripts are bonking" :D


Best

Klaus

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Thu Sep 22, 2011 3:37 am

I am having some issues with LiveCode 4.6.4 which I downloaded yesterday. I am running it on a brand new Mac running Lion. The debugger quit working yesterday. I set breakpoints but nothing happens when I click the mouse. However if I copy the button and click on it the debugger will pop up one time to edit the script and then same story. So I end up copying and pasting the button over and over to get the debugger to work until I finally get the script right. Now not even that stopped working.

So Yea you can tell me that the message paths are always solid and I'm saying yea perhaps.

As far as the script goes its simple. I paste a button on to card 3108 not in a group but on the card with the script

on mouseUp
doSomethingSimple
end mouseUp

In the card 3108's script I have a handler

on doSomethingSimple
answer "hello"
end doSomethingSimple and this is what is returned

executing at 7:33:53 PM
Type Handler: can't find handler
Object Button
Line doSomethingSimple
Hint doSomethingSimple

So what do you think Klaus?

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Message Path Question

Post by WaltBrown » Thu Sep 22, 2011 4:44 am

Not that it's worth much, but I made a stack with your exact code in it and it worked fine (LC4.6.4 on W7x64) as we both would suspect I think. I added breakpoints in the mouseUp and doSomethingSimple handlers and both fired as expected first time, both before and after saving the stack to disk.

The intermittent scribbling in the dictionary window implies some kind of conflict under the IDE, not in it (was it a screen drawing artifact, like missing scan lines, or did it look like a typographic artifact, like intentionally crossed off letters?). I've gotten that (missing scan lines) before (not in LC but other apps) when I have RAM issues (system or GPU), either really out of range buffer settings, dead or slow RAM cells, or some routine screwing around with OS window buffers or scribbling in memory where it shouldn't be (usually pilot error on my part). It's also interesting in that it sounds like it is intermittent. Have you seen anything intermittent in any other windows (LC or other) or apps? Have you tried starting or stopping non-essential software in the system, or running a RAM test, to see if it's possibly localized to a RAM address?

You've probably covered this (don't get upset at me, I'm just trying to think through) has any HW work been done on the new Mac? Like extra RAM put in? Or did you reseat everything inside after shipping? I have had brand new machines show funny intermittent things after any kind of move, and inspecting connections and re-seating all pluggable cards and cables inside has frequently helped (mostly rack servers, but a few PCs as well, but the number is into the hundreds of times I have seen intermittent issues - hi tech road shows are murder on contacts and connectors :-). Plus it's an easy thing to eliminate as a source.

I'm just throwing some thoughts on the table.
Walt Brown
Omnis traductor traditor

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Thu Sep 22, 2011 6:13 am

Thanks for your help walt. The only thing I have done on this machine is load Livecode and XCODE and the IOS tester. I have been going back and forth loading and 4.6.4 and 4.6.3 though trying to get the debugger to work etc. I think I am going to load a fresh instance of 4.6.4 and then rebuild my stack from scratch and not load the MobGui extension and see what happens.
Ill keep ya posted.
Dave

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Message Path Question

Post by Klaus » Thu Sep 22, 2011 11:50 am

Hi Dave,

I can only say that your script MUST work and have no idea what might go on on your side,
but I could offer to take a look at your stack, if you like.

Guessing won't get us very far in a case like this 8)

Just post it here or send it to me directly:
klaus (AT) major-k.de


Best

Klaus

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Here is an example of what I'm dealing with

Post by FireWorx » Thu Sep 22, 2011 5:45 pm

Hi, I loaded LiveCode 4.6.4 the other day and all the sudden the handlers I was calling from a card button to execute some code in the card script were giving me messages that they could not find the handler.

Also my debugger stopped debugging most of the time. Although If I continue to copy and past the contol it would debug the control 1 time.

On my mac running Lion I noticed that as soon as I have 1 line of messed up code in the card script the card buttons can no longer find there handler destinations in the card script. These are unrelated handlers to the one with messed up code in it. Also the debugger doesnt point you to the line of code thats messed up. It just derails the link to every other working handler in the entire stack and leaves you to try and figure out which line of code is messed up and where.

Erase the 1 bad handler and everything works fine.
As long as you write perfect code and never make a mistake your gold.

Do the buttons Do something Cool find their handlers for you Klaus? Because on my Mac they deliver a message handler couldn't be found and I discovered its because of the line of code thats messed up in the unCoolCodeMessingMeUP handler next to it. If livecode pointed me to the bad code or even the sick handler in the card script I would be satisfied but no.

I am interested to see if its my machine running 4.6.4 with Lion thats the problem. This can't be normal.
Dave
Attachments
TestStack.livecode.zip
(1.47 KiB) Downloaded 334 times

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Message Path Question

Post by Klaus » Thu Sep 22, 2011 6:26 pm

Hi Dave,

tested your stack and it worked here!
LC 4.6.3, OS X Lion.

Hm... :?:

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Message Path Question

Post by mwieder » Thu Sep 22, 2011 6:51 pm

Works fine for me, too.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Message Path Question

Post by FireWorx » Thu Sep 22, 2011 7:26 pm

Thats messed up ! When I open the stack and click the "do Something Cool" button the debug window pops up with message

button "Do Something Cool": execution error at line 2 (Handler: can't find handler) near "dosomethingcool", char 1

When I click the button "Do Something even cooler" I get the error message.

button "Do Something even cooler": execution error at line 2 (Handler: can't find handler) near "dosomethingevencooler", char 1

The exact same stack. I have reloaded 4.6.4 three times and have no plugins. I have located it in the application folder the first time and in the Documents folder the second time. There is no other code in this stack other than what is presented.

Now what?

Post Reply