[fxruby-users] trouble with program code separation

dave L dglnz at yahoo.com
Sun Jul 5 01:54:14 EDT 2009


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 at yahoo.com>
To: fxruby-users at rubyforge.org
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 at gmail.com>
To: fxruby-users at rubyforge.org
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 at yahoo.com> 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 at gmail.com>
>
>To: fxruby-users at rubyforge.org
>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
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20090704/236f9313/attachment.html>


More information about the fxruby-users mailing list