[fxruby-users] clipboard example?

Lyle Johnson lyle at knology.net
Sun Apr 10 22:00:35 EDT 2005

On Apr 10, 2005, at 3:39 PM, Jason Wang wrote:

> well, i tried to put it right under the creation of copy button.. but
> when i run it, and click copy button, it returns the following error:
> clipboard.rb:19:in `initialize': undefined local variable or method
> `customerList' for #<ClipMainWindow:0xb73e44f0> (NameError)
>         from clipboard.rb:18:in `call'
>         from  
> /usr/local/lib/ruby/gems/1.8/gems/fxruby-1.2.5/lib/fox12/ 
> responder2.rb:57:in
> `onHandleMsg'
>         from clipboard.rb:48:in `run'
>         from clipboard.rb:48
>         from clipboard.rb:45:in `initialize'
>         from clipboard.rb:45:in `new'
>         from clipboard.rb:45
> no idea wat's wrong :|

Look at the code sample that appears directly under the heading  
"Acquiring the Clipboard" in the clipboard tutorial. You should see  
that toward the end of the ClipMainWindow#initialize method it creates  
a new FXList widget and assigns that to the customerList variable. So  
you'll need to connect this SEL_COMMAND handler for the copy button at  
some point in the code below that assignment, e.g.

	customerList = FXList.new(...)
	$customers.each { |customer| ... }
	copyButton.connect(SEL_COMMAND) { ... }

Hope this helps,


More information about the fxruby-users mailing list