LiveCode crashes with wait command

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
matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

LiveCode crashes with wait command

Post by matthellstrom » Thu Jun 04, 2015 4:50 pm

I'm trying to do something, not sure I've got the right way to do it. I have a search box, I automatically want to run an external db command when they enter something in the search box, but I want it to wait a little so it doesn't try to do it after every character. So I used a wait command, but now if I type in a search term of 5 or 6 characters it crashes. I'm not sure it that's the problem. It actually finishes the command and does the db access, but when it loads the table it crashes. It doesn't crash when I change other parameters using a dropdown box.

Here's the code I use. Please let me know if you need anything else, or give me another idea how to do it.

on textChanged
wait 1 second with messages
set the uCurrentSearchTerm of me to the text of me
call loadItemTable
end textChanged

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: LiveCode crashes with wait command

Post by matthellstrom » Thu Jun 04, 2015 6:02 pm

More experimenting, I don't think it has to do with the wait. I think it has to do with keying in multiple characters and doing a db access that takes a little while. If I put in one character, wait for it to finish, put in another, wait for it to finish, etc. It works fine. It's just if I put in more than one character. Can anyone give me an idea how to do this differently? I can use a search button so it doesn't do anything until they say go, I just thought it would be cool to do it automatically.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: LiveCode crashes with wait command

Post by MaxV » Mon Jun 08, 2015 3:38 pm

I'd split the code this way:

Code: Select all

on textChanged
  searchdb
end textChanged

on searchdb
  wait 1 second with messages
  set the uCurrentSearchTerm of me to the text of me
  call loadItemTable
end searchdb
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: LiveCode crashes with wait command

Post by FourthWorld » Mon Jun 08, 2015 3:53 pm

If that's happening in the current version it may be helpful if you can spare a moment to file a bug report. No scripting engine should ever crash. Most do now and then, but if we stay on top of such reports we can bring that ever closer to zero.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: LiveCode crashes with wait command

Post by matthellstrom » Mon Jun 08, 2015 7:47 pm

MaxV wrote:I'd split the code this way:

Code: Select all

on textChanged
  searchdb
end textChanged

on searchdb
  wait 1 second with messages
  set the uCurrentSearchTerm of me to the text of me
  call loadItemTable
end searchdb
This way does the same thing. If I key in one letter and wait for it to read, it works fine. More than one it crashes.

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: LiveCode crashes with wait command

Post by matthellstrom » Mon Jun 08, 2015 8:29 pm

Here's a super simple stack that I created. If you type in 1 character, it works. If you type in more than one, after you click on ok in the dialog box it crashes.
Attachments
SearchTest.livecode.zip
(1004 Bytes) Downloaded 192 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: LiveCode crashes with wait command

Post by FourthWorld » Mon Jun 08, 2015 8:59 pm

May be platform-specific: using v7.0.5 on Ubuntu 14.10 I can type as many characters as I like, slow or fast, and it seems to work just fine.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: LiveCode crashes with wait command

Post by matthellstrom » Mon Jun 08, 2015 9:02 pm

Maybe I'll try it standalone on Windows, that's what I'm going to be deploying it on.

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: LiveCode crashes with wait command

Post by matthellstrom » Mon Jun 08, 2015 10:15 pm

I tried it on Windows standalone and it works perfectly. Does this happen often where something works on one platform but not on another? I submitted a bug report.

Post Reply