Tried to make sqlite3_calls.rb a subclass of monitorscreen.rb which is generated by foxGUI but not managed it.
> From: Meinrad Recheis <
meinrad.recheis@...>
> Subject: Re: [fxruby-users] trouble with program code separation
> To:
fxruby-users@...
> Received: Tuesday, 30 June, 2009, 2:22 AM
> hi dave,@db is nil at the time
> rec_to_find is called. make sure it is initialized
> correctly.-- henon
>
> On Mon, Jun 29, 2009 at 12:20 PM,
> dave L <
dglnz@...>
> wrote:
>
> Help,
>
> I have a foxGUI gernerated file named monitorwindow and a
> ruby file called sqlite3_calls.rb
>
>
> I want to have my monitorwindow make calls to
> sqlite3_calls.rb and pass through parameters to it so i can
> get data to display to the screen.
>
> I have tried making the code (which currently has only ONE
> method in it called rec_to_find) a class and a
> module but cannot get the link to work.
>
>
> based on the success i had with example ONE of the user
> guide ( although it only used a mouse click) i get this
> error.
>
> /sqlite3_calls.rb:18:in `rec_to_find': undefined method
> `execute' for nil:NilClass (NoMethodError)
>
> from monitorscreen.rbw:65:in
> `construct_widget_tree'
> from
>
> C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in
> `call'
> from
> C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in
> `onHandleMsg'
>
> from monitorscreen.rbw:206:in `run'
> from monitorscreen.rbw:206
> >Exit code: 1
>
> here is the code in sqlite3_calls.rb - as a
> ruby program this works - well as a definition of class it
> does.
>
>
> require 'sqlite3.rb'
>
> module Dbase
> def initialize
> @db = SQLite3::Database.new( "customer" )
> end
>
> def rec_to_find(table, colname, tofind)
> stmt = "select cust_nos, caddress, cname, contact,
> notes, on_stop, phone_nos from #{table} where #{colname} =
> ?"
>
> row = @db.execute(stmt,tofind) # this is the line
> it's borking on - why??
> @rec
> = []
> row.each do|fld|
> @rec = fld
> end
> return @rec
> end
> end
>
> I ahve tried using :: insetad of the fullstop but i get the
> same error!!
>
> also tried having the require sqlite3.rb in the file below
> but it fails there too - same error.
>
> here is some of the code from the mainscreen.rb file.
>
> # source generated by foxGUIb 1.0.0
> require 'sqlite3_calls.rb'
>
> class MainWindow
>
> def initialize( parent)
> extend Dbase
>
> @mydb = Dbase
> construct_widget_tree( parent)
> init if respond_to? 'init'
> end
>
>
> def construct_widget_tree( parent)
>
> code I've inserted to get the customer data returned.
>
> row = rec_to_find('customer', 'cust_nos',
> @dice_code.text)
>
> any help would be appreciated.
>
>
> dave.
>
>
>
>
> Need mail bonding? Bring all your contacts to
> Yahoo!Xtra with TrueSwitch
>
> _______________________________________________
>
> fxruby-users mailing list
>
>
fxruby-users@...
>
>
http://rubyforge.org/mailman/listinfo/fxruby-users>
>
>
> --
> --
> Git# -->
> Git for .NET
>
>
>
>
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> fxruby-users mailing list
>
fxruby-users@...
>
http://rubyforge.org/mailman/listinfo/fxruby-users