我如何创建一个用于查找字符串的对话框

时间:2015-04-24 12:53:15

标签: livecode

如何创建用于查找字符串的对话框。我不知道如何在LiveCode中创建对话框,以便我使用ask命令。是在实时代码中创建对话框的正确方法

global x
    on mouseUp
       ask "What is your name?"
       put it into x
       if x is  empty then 
          answer"wrong input"
       else
            repeat for each word ass in "MytextField"
          --repeat with each word myword in fld"MytextField"
             if  "MytextField" contains myword then 
                find x after "MytextField"
                   end if
          end repeat

          end if
    end mouseUp
    on mouseDown

    end mouseDown

1 个答案:

答案 0 :(得分:0)

您走在正确的轨道上,但您的处理程序有几个语法错误。在按钮脚本中尝试这一点,确保您有一个名为" myTextField"的字段。其中有一些相关的文字:

  on mouseUp
 ask "What is your name?"
 put it into x
 if x is  empty then 
  answer "wrong input"
 else
  repeat for each word myword in fld "MytextField"
     if  fld "MytextField" contains x then find x in fld "MytextField"
     exit to top
  end repeat
 end if
end mouseUp

现在有几种方法可以做同样的事情。请考虑查看LC论坛以获取更多资源。

克雷格纽曼