On Sep 11, 2007, at 5:05 PM, Ed Redman wrote:

> Hello all
> I have written a simple program to run an external system application.
>
> When the application finishes the focus does not return to the ruby/tk
> application. It does not function. Eventually it quits but not in a
> proper fashion.
>
> Here is the program. I hope someone can help.
>
> #!/usr/bin/ruby
>
> require 'tk'
>
> root = TkRoot.new
> root.title "Execute Program"
> $text = TkVariable.new
> frame = TkFrame.new(root)
> frame.borderwidth  10
> frame.pack( 'side' => 'top')
> frame.pack('fill' => 'x')
>
> toprun = TkButton.new(frame)
> toprun.text "Run it"
> toprun.command{ `#{$text}`}

It seems to work if I change the above line to

    toprun.command { system $text.value }

> toprun.pack( 'side' => "right")
>
> topquit = TkButton.new(frame)
> topquit.text "Exit"
> topquit.command{ exit }
> topquit.pack('side' => "right")
>
> label = TkLabel.new(frame)
> label.text   "Command"
> label.pack("padx" => 0)
>
> entry = TkEntry.new(frame)
> entry.textvariable $text
> entry.width 20
> entry.relief 'sunken'
> entry.pack("side" => "left")
> entry.pack("fill" => "x")
> entry.pack("expand" => "true")
>
> Tk.mainloop

Regards, Morton