Syntax for wait

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Syntax for wait

Post by quailcreek » Tue Dec 01, 2015 4:31 am

Hi,
I have a command in the stack script that does some checking and if there is an error it sends answer “there is a problemo.” The command is called be several cards in the stack from a preOpenCard handler. The problem is, because it’s call on preOpenCard, the answer dialog shows up before the card is displayed. I tried wait 1 sec but that didn’t work. Would wait until openCard work? I know I could just change to an openCard handler but I wanted to check with the forum first. Any suggestions would be appreciated.

Code: Select all

command GetContactName pContactID
   local tFullName
   
   if isNumber (pContactID) then
      put mobileGetContactData(pContactID) into theData[contact]
      if the result is an array then 
         if theData[contact]["middlename"] is empty then
            put theData[contact]["firstname"] && theData[contact]["lastname"]  into tFullName
         else
            put theData[contact]["firstname"] && theData[contact]["middlename"] && theData[contact]["lastname"]  into tFullName
         end if
         
         if theData[contact]["suffix"] is not empty then
            put comma && theData[contact]["suffix"] after tFullName
         end if
      else
         wait for something humma humma
         answer "The Contact could not be found. Contact may have been deleted." 
      end if
   end if
   return tFullName
end GetContactName
Tom
MacBook Pro OS Mojave 10.14

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: Syntax for wait

Post by snm » Tue Dec 01, 2015 7:35 am

Use send command. Look for it in Dictionary.

Marek

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Syntax for wait

Post by bn » Tue Dec 01, 2015 9:37 am

What Marek said,

try either in your preopenStack handler

Code: Select all

put contactId into temp
send "getContackName temp" to me in 50 milliseconds
or move the call to getContactId to the openCard handler

Kind regards

Bernd

Post Reply