The standalone and the IDE - a cautionary tale

Graham Samuel livfoss at mac.com
Thu Oct 31 12:52:24 EDT 2013


RunRev have just kindly helped me to solve an issue which I had reported as a bug (number 11183 as it happens) - I have also tried to ask for help from this list from time to time. It turned out to be my error, kind of, but it revealed a difference between running a Livecode program in the IDE and in a standalone, which may be of more general interest. 

Part of my program allowed vector drawing by allowing the user to pick one of the standard graphic tools (rectangle, line, oval, polygon etc) and then to draw on a card. This worked in the IDE, but in the standalone weird stuff happened: for example on clicking with the mouse after a tool selection, a minimum size graphic was created, but the subsequent drag of the mouse while down, in order to establish the size and shape of the graphic, simply didn't work at all. There were other issues to do with the pointer tool, where selection seemed to be impossible using the tool, although it was fine when done by script.

What RunRev were able to show me was that I had a bit of code which detected mouseDown messages in order to see if they could be interpreted as a request for context menu. If the answer was 'no', of course I should have passed the mouseDown, but my script was wrong and I had left this 'pass' statement out. This caused the bad behaviour that I was seeing. However there were a number of oddities about this error: firstly, somehow the IDE got hold of the mouseDown itself and didn't rely on my code passing it on, so the program worked in that context; and secondly, my 'bad' code was situated in the stack script, whereas the drawing takes place on a card belonging to the stack. In my mind, this second fact is confusing, since I imagined that the card would receive the mouseDown first, thus allowing drawing to happen, and any mouseDowns detected by the stack would be there because the card had passed them on or ignored them. So although I had made a coding error, it was (and is) hard for me to see why it affected the drawing actions, which all took place on the card.

I think RR have taken this on board and eventually the difference between the IDE and the standalone will be ironed out - though probably not with a very high priority. Meanwhile I thought I should warn other developers about this strange difference, which made my coding mistake virtually undetectable.

Graham





More information about the Use-livecode mailing list