
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