我如何在鞋上制作一个简单的文本编辑应用程序?

我正在尝试使用Shoes编写一个简单的工具。 这将缩进我们使用的一种模糊的脚本语言的代码。 它有一个大文本框和一个按钮。 我的程序在命令行上运行,但没有运气在鞋子里包装。 如果任何人都可以举一个应用程序的工作示例,执行以下任务来启动并运行,这将非常有用。

当按钮被点击时,我想:获取文本,分割成一行数组(缩进发生在这里),再次连接这些行并使用新数据刷新文本框。


Shoes.app :width => 300, :height => 450 do
  @text = edit_box :width => 1.0, :height => 400
  btn = button 'Indent!'
  btn.click do
    ugly_txt = @text.text
    lines = ugly_txt.split $/ #the record separator
    lines.collect! { |line| '  ' + line } #your indentation would replace this
    @text.text = lines.join $/
  end
end

我认为样本文件夹中有一个示例

链接地址: http://www.djcxy.com/p/79705.html

上一篇: How can I make a simple text editing application in Shoes?

下一篇: License restrictions on including a DLL in another repo?