|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
foxGUIb and the displaying of a dialogbox
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: foxGUIb and the displaying of a dialogboxOn Mon, Jul 13, 2009 at 11:34 AM, dave L <dglnz@...> wrote:
it should be @topwin (a foxguib generated instance variale pointing to the top most widget of a foxguib class), not :@topwin which is simply a symbol. -- henon _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
||
|
|
|
||
|
|
|
| Okay so i've done a number of test and have found that this code snippet will give me a blank window in the top left of the screen. def init #dialog = Fox::FxDialogBox.new( :@topwin) # or FX::DialogBox.new(mainwindow) @textfield1.connect(Fox::SEL_KEYRELEASE){ if @textfield1.text.length == 2 then @Dialog = FX::DialogBox.new @topwin @Dialog.create @Dialog.show(FOX::PLACEMENT_DEFAULT) @text2.text = '10 max chars only!!!' end def init #dialog = Fox::FxDialogBox.new( :@topwin) # or FX::DialogBox.new(mainwindow) @textfield1.connect(Fox::SEL_KEYRELEASE){ if @textfield1.text.length == 2 then @Dialog = FX::DialogBox.new @topwin @Dialog.create @Dialog.show #(FOX::PLACEMENT_DEFAULT) @text2.text = '10 max chars only!!!' end gives me a blank window no widgits visible!!! if the comment (FOX::PLACEMENT_DEFAULT) is removed i get an error referring to FOX then if i remove FOX:: i get an error referring to PLACEMENT_DEFAULT. so i am able to get A window opened with title for the window title. Now i do have this code file called monitordxlogsel_seq and it differs only in the fact that it has no class OR module definition. So i could just paste it directly into my event code and call it as part of the code OR try to LOAD it into the code so it would be treated as virtual code but I am being out smarted anyone able to give better pointers on correcting the problems and perhaps highlight any short comings of either approach? # source generated by foxGUIb 1.0.0 FX::DialogBox.new(parent){|w| @dialogBox=w w.wdg_name='dialogBox' w.packingHints=98304 w.width=356 w.shown=true w.y=149 w.height=238 w.decorations=3276800 w.layoutHints=3 w.x=261 snippet ends***** I have tried to do this.... require 'sqlite3_calls.rb' require 'monitordxlogsel_seq' require 'monitorscreen' class Fxwindow_code < MainWindow def initialize(parent) super @mydb = Dbase.new end #dialog = FOX::FXDialogBox.new( mainwindow) # or FX::DialogBox.new(mainwindow) def init #dialog = Fox::FxDialogBox.new( :@topwin) # or FX::DialogBox.new(mainwindow) @textfield1.connect(Fox::SEL_KEYRELEASE){ if @textfield1.text.length == 2 then @Dialog = load do monitordxlogsel_seq end @Dialog.create @Dialog.show @text2.text = '10 max chars only!!!' end errors here are... >ruby mymainwin.rb ./monitordxlogsel_seq.rb:3: uninitialized constant FX (NameError) from C:/Ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from C:/Ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from mymainwin.rb:2 >Exit code: 1 My aim was to try and pull the code from monitordxlogsel_seq into mymainwin code. in fact i've just done this... 17 if @textfield1.text.length == 2 then 18 @Dialog < class Monitordxlogsel_seq {load Monitordxlogsel_seq } end 19 @Dialog.create and got these errors so must be getting closer to a solution. >ruby mymainwin.rb mymainwin.rb:18: syntax error, unexpected kEND, expecting tCOLON2 or '[' or '.' >Exit code: 1 change line 18 to @Dialog < class Monitordxlogsel_seq {load Monitordxlogsel_seq} gives this error >ruby mymainwin.rb mymainwin.rb:18: syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.' >Exit code: 1 coding example would be great help too. thanks dave. |
Okay so i've done a number of test and have found that this code snippet will give me a blank window in the top left of the screen.
def init@Dialog = FX::DialogBox.new @topwin
#dialog = Fox::FxDialogBox.new( :@topwin) # or FX::DialogBox.new(mainwindow)
@textfield1.connect(Fox::SEL_KEYRELEASE){
if @textfield1.text.length == 2 then
@Dialog.create@Dialog.show(FOX::PLACEMENT_DEFAULT)def init
@text2.text = '10 max chars only!!!'
end@Dialog = FX::DialogBox.new @topwin
#dialog = Fox::FxDialogBox.new( :@topwin) # or FX::DialogBox.new(mainwindow)
@textfield1.connect(Fox::SEL_KEYRELEASE){
if @textfield1.text.length == 2 then
@Dialog.create@Dialog.show #(FOX::PLACEMENT_DEFAULT)gives me a blank window no widgits visible!!!
@text2.text = '10 max chars only!!!'
end
| Okay, After some snooping and trails i have got - 1 file containing the foxGUI code in it. - 1 file with event handling code in it. they are listed below. # source generated by foxGUIb 1.0.0 class DialogBox def initialize( parent) construct_widget_tree( parent) init if respond_to? 'init' end def construct_widget_tree( parent) @topwin= FX::DialogBox.new(parent){|w| @dialogBox=w w.wdg_name='dialogBox' w.packingHints=98304 w.width=380 w.shown=true w.y=217 w.height=366 w.decorations=3276800 w.title="test dialogBox" w.layoutHints=3 w.x=220 FX::Label.new(@dialogBox){|w| @label1=w w.wdg_name='label1' w.width=40 w.height=21 } FX::Button.new(@dialogBox){|w| @button1=w w.wdg_name='button1' w.width=40 w.y=25 w.height=21 } } end attr_reader :topwin attr_reader :dialogBox attr_reader :label5 attr_reader :button5 end my event code below require 'monitordxlog' class Mondialog < DialogBox def initialize(parent) super end def init @button5.connect(Fox::SEL_COMMAND){ ID_QUIT } end end #unit test if __FILE__==$0 require 'libGUIb16' app=FX::App.new w=DialogBox.new app w.topwin.show(Fox::PLACEMENT_SCREEN) app.create app.run end now running my event code WILL display a dialogbox BUT nothing happens when the button is clicked!!! I have compared the code to my other one - mymainwin and to me they are the same in so far as the require dosen't have a .rb in it. in the initialize i have parent as a parameter and super as a reference to the foxGUI code. what am i missing? - Lye you able to help me on this? is what i get after clicking on the X - close button on the title bar. >ruby monitordxlog_evnts.rb >Exit code: -1073741510 1 step closer to intergrating the dialogbox with my mainwindow program (I think) |
| Dam please note i have fixed an error in the code - button5 should be button1 and also the unit test within the foxGUI was leftout as it is the same as that in my event handling file - saving some lines of code too. dave. --- On Wed, 15/7/09, dave L <dglnz@...> wrote:
|
Okay,
After some snooping and trails i have got
- 1 file containing the foxGUI code in it.
- 1 file with event handling code in it.
they are listed below.class DialogBox
# source generated by foxGUIb 1.0.0
def initialize( parent)
construct_widget_tree( parent)
init if respond_to? 'init'
end
def construct_widget_tree( parent)
@topwin=w.width=380
FX::DialogBox.new(parent){|w|
@dialogBox=w
w.wdg_name='dialogBox'
w.packingHints=98304
w.shown=true
w.y=217
w.height=366
w.decorations=3276800
w.title="test dialogBox"
w.layoutHints=3
w.x=220
FX::Label.new(@dialogBox){|w|
@label1=w
w.wdg_name='label1'
w.width=40
w.height=21
}
FX::Button.new(@dialogBox){|w|
@button1=w
w.wdg_name='button1'
w.width=40
w.y=25
w.height=21
}
}
end
attr_reader :topwin
attr_reader :dialogBox
attr_reader :label5
attr_reader :button5
end
my event code below
require 'monitordxlog'
class Mondialog < DialogBox
def initialize(parent)
super
end
def init
@button5.connect(Fox::SEL_COMMAND){
ID_QUIT
}
end
end
#unit test
if __FILE__==$0
require 'libGUIb16'
app=FX::App.new
w=DialogBox.new app
w.topwin.show(Fox::PLACEMENT_SCREEN)
app.create
app.run
end
now running my event code WILL display a dialogbox BUT nothing happens when the button is clicked!!!
I have compared the code to my other one - mymainwin and to me they are the same in so far as the require dosen't have a .rb in it.
in the initialize i have parent as a parameter and super as a reference to the foxGUI code.
what am i missing? - Lye you able to help me on this?
is what i get after clicking on the X - close button on the title bar.
>ruby monitordxlog_evnts.rb
>Exit code: -1073741510
1 step closer to intergrating the dialogbox with my mainwindow program (I think)
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
| Free embeddable forum powered by Nabble | Forum Help |