smartAnswer()

This function requires LiveCode and returns the button clicked from an answer dialog of an Icon, Title, Body and up to three User Responses.
It will automatically adapt to platform considerations including font display, icons, button placement, dimensions and positioning.

Full details are in the stack script.

Syntax
smartAnswer(tIcon ["global"],tTitle,tBody,[btn1] [,btn2 [,btn3]] )

Example 1

get smartAnswer("warn","Do you want to save changes?","Any unsaved work will be lost.","Yes","No","Cancel")
if it is "Yes" then...
else if it is "No" then...
else if it is "Cancel" then ...


Example 2
You can include variables, of course...

get smartAnswer("stop GLOBAL","Error","An error is reported:" &cr& tErr,"OK")


To use
1. Import smartAnswer.rev into your main stack.
2. Copy and paste this into your main stack script...

function smartAnswer pType,pStr1,pStr2,pBtn1,pBtn2,pBtn3
  local tSelChunk
  if word 2 of pType = "GLOBAL" then
    put FALSE into asSheet
    put word 1 of pType into pType
  else put TRUE into asSheet
  set the cType of stack "smartAnswer" to pType
  set the cStr1 of stack "smartAnswer" to pStr1
  set the cStr2 of stack "smartAnswer" to pStr2
  set the cDefBtn of stack "smartAnswer" to pBtn1
  set the cBtn2 of stack "smartAnswer" to pBtn2
  set the cBtn3 of stack "smartAnswer" to pBtn3
  if the selectedChunk <>"" then put the selectedChunk into tSelChunk
  if asSheet then open wd "smartAnswer" as sheet
  else open wd "smartAnswer" as modal
  if tSelChunk <>"" then
    try
      select tSelChunk
    end try
  end if
  wait 5
  return the responseValue of stack "smartAnswer"
end smartAnswer