Livecode environment crashing when testing app

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
vince
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 21
Joined: Wed Aug 29, 2012 8:51 pm

Livecode environment crashing when testing app

Post by vince » Wed Aug 29, 2012 10:13 pm

I am currently fiddling around with my first app in which i decided to try to read from one file in chunks and to write those chunks to another file until the EOF is reached. Thereby the file will be effectively copied over. Off course there are built-in functions for this but i want to extend this furter to be able to measure speeds, progress, limit speeds and to pause the copy so i need to have total control over the copy process.

The thing is however that when i switch to "live" mode (which is debugging i assume) and click the button which fires off my test the whole Livecode environment hangs (Windows white screen, not responding anymore when clicked). Off course i will probable have made a nasty bug (or two!) which reads past the EOF or something like that, but shouldn't i be able to debug this or at least terminate the debugging and try again? Now i must force close the whole Livecode environment and start it again.

So i'm not asking what i have coded wrong (which i know i have) but i would like to know if it is normal for this to happen or if i can avoid this? From my limited experience with other programming languages (Delphi, c#) i always had complete control in the debugger which is what you would also expect from a debugger.

Thanks :D

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

Re: Livecode environment crashing when testing app

Post by mwieder » Wed Aug 29, 2012 11:17 pm

Well, it's hard to make things completely idiot-proof :P
I fall down that rabbit hole a lot.

My guess is that you have some kind of a tight loop in your code that's not letting the system get any breathing room. If that's the case it won't respond to mouse clicks or any other sort of attempted interruption.

Try putting something in your loop that's waiting for input

Code: Select all

wait 0 milliseconds with messages
will do essentially nothing, but the "with messages" part will check for any system events that have occurred and handle them if necessary. You can also insert something like

Code: Select all

if the mouse is down then
  exit repeat
end if

vince
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 21
Joined: Wed Aug 29, 2012 8:51 pm

Re: Livecode environment crashing when testing app

Post by vince » Thu Aug 30, 2012 9:21 am

Yes i have a loop in my code. I will try to add the "wait" into it to see if this makes a difference. From what you tell i can imagine that it will "hang up" itself in such a loop.

This is my code by the way:

Code: Select all

on mouseUp
   put "C:\test.exe" into file1 -- exisiting source file of 50MB
   put "C:\test2.exe" into file2
   open file file1 for binary read
   open file file2 for binary write
   
   repeat until file1 eof
      read from file file1 for 4096
      write it to file file2
      get the label of field "lblTest" -- label is initially "0"
      put it into progress
      set the label of field "lblTest" to progress + 4096
   end repeat
   
end mouseUp
I put it up here so maybe (hopefully) i stumble upon it somewhere in the future and it will make me laugh :wink:

vince
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 21
Joined: Wed Aug 29, 2012 8:51 pm

Re: Livecode environment crashing when testing app

Post by vince » Thu Aug 30, 2012 8:09 pm

Using an example of runrev i have found online i have now successfully implemented the file copy routine. All this is just me learning Livecode which is quite different in programming style when compared to more traditional languages - it does take time getting used to it :)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Livecode environment crashing when testing app

Post by jacque » Thu Aug 30, 2012 9:59 pm

Yup, but once you "get it" it's much easier than other languages. Or at least, I think so.

You were in an infinite loop because the syntax in the test condition was wrong, but you probably know that by now. Carry on, and holler if you need us. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply