trouble with program code separation

View: New views
10 Messages — Rating Filter:   Alert me  

trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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

Re: trouble with program code separation

by Meinrad Recheis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Parent Message unknown Re: trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Yes I thought so too and tried doing this

extend Dbase
@db = Dbase.new
but it borks because the code is a module not a class!

so how would i use it as a class and thus eliminate the problem.

I've tried all i know (with my limited knowledge of fxruby/foxGUI & ruby)

Tried to make sqlite3_calls.rb a subclass of monitorscreen.rb which is generated by foxGUI but not managed it.

your help appriciated.

Dave.

--- On Tue, 30/6/09, Meinrad Recheis <meinrad.recheis@...> wrote:

> 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


     
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Parent Message unknown Re: trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Henon,

Just looking at the code snippet below and want to ask if i should have everything in sqlite3_calls.rb wrapped in a init define as that's what got my 1st sample program working from the user guide.

e.g.

module Dbase
  def init
    # original code put in here
  end

end

rgds,

dave.

--- On Tue, 30/6/09, Meinrad Recheis <meinrad.recheis@...> wrote:

> 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


     
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: trouble with program code separation

by Meinrad Recheis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

On Tue, Jun 30, 2009 at 12:14 AM, dave L <dglnz@...> wrote:

Henon,

Just looking at the code snippet below and want to ask if i should have everything in sqlite3_calls.rb wrapped in a init define as that's what got my 1st sample program working from the user guide.

e.g.

module Dbase
 def init
   # original code put in here
 end

end

rgds,

dave.

--- On Tue, 30/6/09, Meinrad Recheis <meinrad.recheis@...> wrote:

> 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



_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users


_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Thanks Meinrad for your reply,

I had tried doing something like this but it didn't work in the last couple of days - Grrrr.

Now before when i had the code inside the foxGUIb generated file when i entered something into the textfield which is named @acc_code I had it so that the value was put into a label (which just happened to hold the word Address on the screen - this was more for me to see that the enter key worked or not.

Now the code below this fails! - so it's two steps forward 1 back.
I readily admit that i'm not the brightest programmer so what seems logical sometimes for me when it's not shown is a mistery hense i go a bit overboard sometimes to explain my problem.

So I've commented out all references to my program sqlite3_calls.rb to try and get the keypress to work
that is when the ENTER key is press i want the value to be shown on a label just to prove it works.

Once that's done then it's one step to uncomment the references to SQLite3_calls and pass the value through to get a customer record returned and to have some values displayed on screen.

My current code for MainWindow - foxGUIb generated code & my hand coded event handler code.

yours or that of others on this list would be greatly appreciated



From: Meinrad Recheis <meinrad.recheis@...>
To: fxruby-users@...
Sent: Thursday, 2 July, 2009 9:35:17 AM
Subject: Re: [fxruby-users] trouble with program code separation

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

lot's snippted

Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.
                 My code written tonight after viewing your reply.
require 'monitorscreen.rb'
#require 'sqlite3_calls.rb'

#include Dbase
class Fxwindow_code < MainWindow
 
  def initialize(parent)
      super
        #@mydb = dbase.new
  end
 
  def init
# just put the characters to a label on the screen - easy debug solution for me to see
# if the user entry gets passed through
#                   - when there is a key press - SEL_KEYRELEASE message is sent
#                   - ENTER key was pressed or not - comment out the sel_RELEASE block to see effect.
#
#          Currently there is NO EVENT BEING FIRED
    @acc_code.connect(Fox::SEL_KEYRELEASE){                  
      @label4.text = @acc_code.text
    }

    @acc_code.connect(Fox::SEL_COMMAND){
      @label4.text = @acc_code.text
#      row = @mydb.rec_to_find('customers', 'cust_nos', @dice_code.text)
#      cname = row[2]
#      call_centre = row[3]
#      phone_no = row[6]
#      text1.text = row[1]
    }

  end
end


# source generated by foxGUIb 1.0.0

class MainWindow
 
    def initialize( parent)  
        construct_widget_tree( parent)
        init if respond_to? 'init'
    end
   
    def construct_widget_tree( parent)
        @topwin=
        FX::MainWindow.new(parent){|w|
            @mainWindow=w
            w.wdg_name='mainWindow'
            w.width=779
            w.shown=true
            w.y=89
            w.height=605
            w.decorations=29229056
            w.title="Patrol Monitoring Screen"
            w.layoutHints=828
            w.x=148
            @mainWindow.connect(Fox::SEL_FOCUS_UP){
                text1.setfocus
            }
            FX::Label.new(@mainWindow){|w|
                @label1=w
                w.wdg_name='label1'
                w.text="Acc - Code"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=75
                w.y=10
                w.height=23
                w.layoutHints=60
                w.x=10
            }
            FX::Label.new(@mainWindow){|w|
                @label2=w
                w.wdg_name='label2'
                w.text="Customer name"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=116
                w.y=10
                w.height=23
                w.layoutHints=60
                w.x=200
            }
            FX::TextField.new(@mainWindow){|w|
                @acc_code=w
                w.wdg_name='acc_code'
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=96
                w.y=10
                w.height=25
                w.numColumns=10
                w.layoutHints=60
                w.x=90
            }
            FX::Label.new(@mainWindow){|w|
                @cname=w
                w.wdg_name='cname'
                w.text="displayed name"
                w.font=FX::Font.new.from_s('Tahoma|120|70|5|0|0|0').to_FXFont
                w.width=131
                w.y=10
                w.height=23
                w.layoutHints=60
                w.x=330
            }
            FX::Label.new(@mainWindow){|w|
                @label4=w
                w.wdg_name='label4'
                w.text="Address"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=61
                w.y=50
                w.height=23
                w.layoutHints=60
                w.x=30
            }
            FX::Text.new(@mainWindow){|w|
                @text1=w
                w.wdg_name='text1'
                w.width=295
                w.y=80
                w.height=200
                w.layoutHints=828
                w.x=30
            }
            FX::Label.new(@mainWindow){|w|
                @label6=w
                w.wdg_name='label6'
                w.text="Call Centre"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=81
                w.y=50
                w.height=23
                w.layoutHints=60
                w.x=330
            }
            FX::Label.new(@mainWindow){|w|
                @call_centre=w
                w.wdg_name='call_centre'
                w.text="Alarm call centre name"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=167
                w.y=50
                w.height=23
                w.layoutHints=60
                w.x=420
            }
            FX::Label.new(@mainWindow){|w|
                @label8=w
                w.wdg_name='label8'
                w.text="To Call"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=54
                w.y=90
                w.height=23
                w.layoutHints=60
                w.x=330
            }
            FX::Label.new(@mainWindow){|w|
                @label9=w
                w.wdg_name='label9'
                w.text="Phone #"
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=65
                w.y=130
                w.height=23
                w.layoutHints=60
                w.x=330
            }
            FX::Label.new(@mainWindow){|w|
                @to_call=w
                w.wdg_name='to_call'
                w.text="Persons name here"
                w.font=FX::Font.new.from_s('Tahoma|120|70|5|0|0|0').to_FXFont
                w.width=160
                w.y=90
                w.height=23
                w.layoutHints=60
                w.x=420
            }
            FX::Label.new(@mainWindow){|w|
                @phone_no=w
                w.wdg_name='phone_no'
                w.text="Phone # put here"
                w.frameStyle=4096
                w.font=FX::Font.new.from_s('Tahoma|120|70|5|0|0|0').to_FXFont
                w.width=149
                w.y=130
                w.height=25
                w.layoutHints=60
                w.x=420
            }
            FX::List.new(@mainWindow){|w|
                @jobs_list=w
                w.wdg_name='jobs_list'
                w.font=FX::Font.new.from_s('Tahoma|120|40|5|0|0|0').to_FXFont
                w.width=765
                w.y=310
                w.height=285
                w.layoutHints=3900
                w.x=5
            }
        }
    end
    attr_reader :topwin
    attr_reader :mainWindow
    attr_reader :label1
    attr_reader :label2
    attr_reader :dice_code
    attr_reader :cname
    attr_reader :label4
    attr_reader :text1
    attr_reader :label6
    attr_reader :call_centre
    attr_reader :label8
    attr_reader :label9
    attr_reader :to_call
    attr_reader :phone_no
    attr_reader :jobs_list
end

#unit test
if __FILE__==$0
    require 'libGUIb16'
    app=FX::App.new
    w=MainWindow.new app
    w.topwin.show(Fox::PLACEMENT_SCREEN)
    app.create
    app.run
end
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: trouble with program code separation

by Meinrad Recheis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the code seems correct to me, what problem are you having?

On Thu, Jul 2, 2009 at 12:37 PM, dave L <dglnz@...> wrote:
Thanks Meinrad for your reply,

I had tried doing something like this but it didn't work in the last couple of days - Grrrr.

Now before when i had the code inside the foxGUIb generated file when i entered something into the textfield which is named @acc_code I had it so that the value was put into a label (which just happened to hold the word Address on the screen - this was more for me to see that the enter key worked or not.

Now the code below this fails! - so it's two steps forward 1 back.
I readily admit that i'm not the brightest programmer so what seems logical sometimes for me when it's not shown is a mistery hense i go a bit overboard sometimes to explain my problem.

So I've commented out all references to my program sqlite3_calls.rb to try and get the keypress to work
that is when the ENTER key is press i want the value to be shown on a label just to prove it works.

Once that's done then it's one step to uncomment the references to SQLite3_calls and pass the value through to get a customer record returned and to have some values displayed on screen.

My current code for MainWindow - foxGUIb generated code & my hand coded event handler code.

yours or that of others on this list would be greatly appreciated



From: Meinrad Recheis <meinrad.recheis@...>
Sent: Thursday, 2 July, 2009 9:35:17 AM

Subject: Re: [fxruby-users] trouble with program code separation

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

lot's snippted

Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users


_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Have you run my code?
what results did YOU get - text entered appear in label4 (aka Address)?

for me running the program (has the code generated by foxGUIb) it fails to pass any event triggers to the code i had written so when i type in 12345 i see it in the textfield but the text in label4 (Address) is unchanged and when the enter key is pressed again no change to the text displayed (changing my code from a class to a module does nothing, changing the include to an extend does nothing either).

From my experiments of trying different things to try and get the two to interact I have no events being fired OR passed through to my code.

could you _or_ anyone else using foxGUIb1.0.0 try the code attached in my previous email see what results they get?

this is VERY frustrating for me as i did have the code working when the event code was inside of foxGUIb generated code.

Dave.





From: Meinrad Recheis <meinrad.recheis@...>
To: fxruby-users@...
Sent: Saturday, 4 July, 2009 9:41:37 PM
Subject: Re: [fxruby-users] trouble with program code separation

the code seems correct to me, what problem are you having?

On Thu, Jul 2, 2009 at 12:37 PM, dave L <dglnz@...> wrote:
Thanks Meinrad for your reply,

I had tried doing something like this but it didn't work in the last couple of days - Grrrr.

Now before when i had the code inside the foxGUIb generated file when i entered something into the textfield which is named @acc_code I had it so that the value was put into a label (which just happened to hold the word Address on the screen - this was more for me to see that the enter key worked or not.

Now the code below this fails! - so it's two steps forward 1 back.
I readily admit that i'm not the brightest programmer so what seems logical sometimes for me when it's not shown is a mistery hense i go a bit overboard sometimes to explain my problem.

So I've commented out all references to my program sqlite3_calls.rb to try and get the keypress to work
that is when the ENTER key is press i want the value to be shown on a label just to prove it works.

Once that's done then it's one step to uncomment the references to SQLite3_calls and pass the value through to get a customer record returned and to have some values displayed on screen.

My current code for MainWindow - foxGUIb generated code & my hand coded event handler code.

yours or that of others on this list would be greatly appreciated



From: Meinrad Recheis <meinrad.recheis@...>
Sent: Thursday, 2 July, 2009 9:35:17 AM

Subject: Re: [fxruby-users] trouble with program code separation

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

lot's snippted

Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users


Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: trouble with program code separation

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Just tried this as an experiment.

what i did was to change the init if respond_to? 'init' line within the foxGUIb code to a puts 'yes' if respond_to? 'init'.

Now using Sicite i expected to see in the output screen yes displayed either during program execution or after the program is closed.

But nothing happened!! so i can only think that the generated code doesn't know anything about my code.

If that is so then i copied and pasted the unit test across to my code and ran my code and got no response either.

dave.


# source generated by foxGUIb 1.0.0

class MainWindow
 
    def initialize( parent) 
        construct_widget_tree( parent)
        puts 'yes' if respond_to? 'init'
    end
  
    def construct_widget_tree( parent)
        @topwin=
        FX::MainWindow.new(parent){|w|
            @mainWindow=w
            w.wdg_name='mainWindow'



                 My code written tonight after viewing your reply.
require 'monitorscreen.rb'
#require 'sqlite3_calls.rb'

#include Dbase
class Fxwindow_code < MainWindow
 
  def initialize(parent)
      super
        #@mydb = dbase.new
  end
 
  def init
# just put the characters to a label on the screen - easy debug solution for me to see
# if the user entry gets passed through
#                   - when there is a key press - SEL_KEYRELEASE message is sent
#




From: dave L <dglnz@...>
To: fxruby-users@...
Sent: Sunday, 5 July, 2009 4:41:12 PM
Subject: Re: [fxruby-users] trouble with program code separation

Have you run my code?
what results did YOU get - text entered appear in label4 (aka Address)?

for me running the program (has the code generated by foxGUIb) it fails to pass any event triggers to the code i had written so when i type in 12345 i see it in the textfield but the text in label4 (Address) is unchanged and when the enter key is pressed again no change to the text displayed (changing my code from a class to a module does nothing, changing the include to an extend does nothing either).

From my experiments of trying different things to try and get the two to interact I have no events being fired OR passed through to my code.

could you _or_ anyone else using foxGUIb1.0.0 try the code attached in my previous email see what results they get?

this is VERY frustrating for me as i did have the code working when the event code was inside of foxGUIb generated code.

Dave.





From: Meinrad Recheis <meinrad.recheis@...>
To: fxruby-users@...
Sent: Saturday, 4 July, 2009 9:41:37 PM
Subject: Re: [fxruby-users] trouble with program code separation

the code seems correct to me, what problem are you having?

On Thu, Jul 2, 2009 at 12:37 PM, dave L <dglnz@...> wrote:
Thanks Meinrad for your reply,

I had tried doing something like this but it didn't work in the last couple of days - Grrrr.

Now before when i had the code inside the foxGUIb generated file when i entered something into the textfield which is named @acc_code I had it so that the value was put into a label (which just happened to hold the word Address on the screen - this was more for me to see that the enter key worked or not.

Now the code below this fails! - so it's two steps forward 1 back.
I readily admit that i'm not the brightest programmer so what seems logical sometimes for me when it's not shown is a mistery hense i go a bit overboard sometimes to explain my problem.

So I've commented out all references to my program sqlite3_calls.rb to try and get the keypress to work
that is when the ENTER key is press i want the value to be shown on a label just to prove it works.

Once that's done then it's one step to uncomment the references to SQLite3_calls and pass the value through to get a customer record returned and to have some values displayed on screen.

My current code for MainWindow - foxGUIb generated code & my hand coded event handler code.

yours or that of others on this list would be greatly appreciated



From: Meinrad Recheis <meinrad.recheis@...>
Sent: Thursday, 2 July, 2009 9:35:17 AM

Subject: Re: [fxruby-users] trouble with program code separation

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

some snipped


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

Re: trouble with program code separation

by Meinrad Recheis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

oh, now I understand your problem! sorry I honestly didn't think that you wouldn't know it:
you need to instantiate the derived class of course (in your example it is Fxwindow_code you need to create and show). If you create the base class (MainWindow in your example) then only the foxguib generated code is executed without your additions.

you are having such a frustrating time, because you don't seem to know how objects work in ruby. I strongly advise you to read through the pickaxe chapter "Classes, Objects, and Variables"  to find out. -->  http://www.ruby-doc.org/docs/ProgrammingRuby/

hth,
-- henon

On Sun, Jul 5, 2009 at 7:54 AM, dave L <dglnz@...> wrote:
Just tried this as an experiment.

what i did was to change the init if respond_to? 'init' line within the foxGUIb code to a puts 'yes' if respond_to? 'init'.

Now using Sicite i expected to see in the output screen yes displayed either during program execution or after the program is closed.

But nothing happened!! so i can only think that the generated code doesn't know anything about my code.

If that is so then i copied and pasted the unit test across to my code and ran my code and got no response either.

dave.



# source generated by foxGUIb 1.0.0

class MainWindow

 
    def initialize( parent) 
        construct_widget_tree( parent)
        puts 'yes' if respond_to? 'init'

    end
  
    def construct_widget_tree( parent)
        @topwin=
        FX::MainWindow.new(parent){|w|
            @mainWindow=w
            w.wdg_name='mainWindow'



                 My code written tonight after viewing your reply.
require 'monitorscreen.rb'
#require 'sqlite3_calls.rb'

#include Dbase
class Fxwindow_code < MainWindow
 
  def initialize(parent)
      super
        #@mydb = dbase.new
  end
 
  def init
# just put the characters to a label on the screen - easy debug solution for me to see
# if the user entry gets passed through
#                   - when there is a key press - SEL_KEYRELEASE message is sent
#




From: dave L <dglnz@...>Sent: Sunday, 5 July, 2009 4:41:12 PM

Subject: Re: [fxruby-users] trouble with program code separation

Have you run my code?
what results did YOU get - text entered appear in label4 (aka Address)?

for me running the program (has the code generated by foxGUIb) it fails to pass any event triggers to the code i had written so when i type in 12345 i see it in the textfield but the text in label4 (Address) is unchanged and when the enter key is pressed again no change to the text displayed (changing my code from a class to a module does nothing, changing the include to an extend does nothing either).

From my experiments of trying different things to try and get the two to interact I have no events being fired OR passed through to my code.

could you _or_ anyone else using foxGUIb1.0.0 try the code attached in my previous email see what results they get?

this is VERY frustrating for me as i did have the code working when the event code was inside of foxGUIb generated code.

Dave.





From: Meinrad Recheis <meinrad.recheis@...>
To: fxruby-users@...
Sent: Saturday, 4 July, 2009 9:41:37 PM
Subject: Re: [fxruby-users] trouble with program code separation

the code seems correct to me, what problem are you having?

On Thu, Jul 2, 2009 at 12:37 PM, dave L <dglnz@...> wrote:
Thanks Meinrad for your reply,

I had tried doing something like this but it didn't work in the last couple of days - Grrrr.

Now before when i had the code inside the foxGUIb generated file when i entered something into the textfield which is named @acc_code I had it so that the value was put into a label (which just happened to hold the word Address on the screen - this was more for me to see that the enter key worked or not.

Now the code below this fails! - so it's two steps forward 1 back.
I readily admit that i'm not the brightest programmer so what seems logical sometimes for me when it's not shown is a mistery hense i go a bit overboard sometimes to explain my problem.

So I've commented out all references to my program sqlite3_calls.rb to try and get the keypress to work
that is when the ENTER key is press i want the value to be shown on a label just to prove it works.

Once that's done then it's one step to uncomment the references to SQLite3_calls and pass the value through to get a customer record returned and to have some values displayed on screen.

My current code for MainWindow - foxGUIb generated code & my hand coded event handler code.

yours or that of others on this list would be greatly appreciated



From: Meinrad Recheis <meinrad.recheis@...>
Sent: Thursday, 2 July, 2009 9:35:17 AM

Subject: Re: [fxruby-users] trouble with program code separation

dave,
I don't see the whole code, so I can not exactly tell you how to fix your problem. maybe 
a small example will help you:

class MainWindow # generated by foxguib
     def initialize( parent)  
         construct_widget_tree( parent)
         init if respond_to? 'init'
     end
    

     def construct_widget_tree( parent)
       # here the gui is created by foxguib code
    end
end
  
# you don't want to change the above autogenerated class in case you want to change it later and regenerate it.  
# everything that MainWindow should do that is not provided by foxguib goes in a subclass:

class DBWindow < MainWindow # your code
  def initialize(parent)
    super
    # do your stuff here for example:
    @mydb = Dbase.new
  end
end

hth,
-- Henon

some snipped


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


_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users