this wait until works

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ToreT
Posts: 14
Joined: Sat Jan 27, 2007 8:41 pm

this wait until works

Post by ToreT » Sun Feb 25, 2007 9:32 pm

Hi,
finally made it, do not how I can upload the stack though...in case someone would like it.

Regards
Tore

Code: Select all

local fromTheBeginning, exitHandler

on oneMoreLine
  -- this handler is for the "Next Line" button
  if fromTheBeginning = true
  then
    -- start handler:
    oneLineAtTheTime
  else
    set the cCustomProp of me to true
  end if
end oneMoreLine

on oneLineAtTheTime
  set the cCustomProp of me to false
  put false into exitHandler
  put false into fromTheBeginning
  repeat with i = 1 to the number of lines in field "myField"
    select line i of field "myField"
    wait until the cCustomProp of me is true with messages
    if exitHandler is true then exit to top
    set the cCustomProp of me to false
  end repeat
  put true into fromTheBeginning
end oneLineAtTheTime

on exitHandlerOneLineAtTheTime
  -- this handler is for the "Exit Loop" button
  put true into exitHandler
  set the cCustomProp of me to true
  put true into fromTheBeginning
end exitHandlerOneLineAtTheTime

on closeStack
  exitHandlerOneLineAtTheTime
end closeStack

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm

Post by xApple » Sun Feb 25, 2007 9:56 pm

Ah I see what you are trying to do.
You could have just used a global variable like this:

Code: Select all

on mouseUp
  global i
  if i is empty then put 1 into i
  select line i of field "myField" 
  if i = the number of lines in field "myField" then put 1 into i
  add one to i
end mouseUp

ToreT
Posts: 14
Joined: Sat Jan 27, 2007 8:41 pm

Post by ToreT » Fri Mar 02, 2007 10:02 pm

no, the whole point was to use "wait until" in one handler and restart it from another handler. This was just to test it, I skipped all the other stuff and reasons for doing it.

Maybe a bit confusing that i made both handlers start from one button handler.

I should not have put a subject on the last message, because it was supposed to hang on to my other posted subject "Restarting a handler by a message"

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Sat Mar 03, 2007 2:00 am

ToreT wrote:no, the whole point was to use "wait until" in one handler and restart it from another handler. This was just to test it, I skipped all the other stuff and reasons for doing it."
Hi ToreT,

Note there was some related discussion on the use-revolution list. It is archived on the codes CMS under like pass, but without ending the handler

Post Reply