On Thu, Jul 30, 2009 at 12:37 PM, dave L
<dglnz@...> wrote:
Hi folks,
I am using foxGUI for the creation of my GUI front end and what l know about ruby for the event handling.
Now i have a main window that works (well does limited things for me at present). But one of the things i wish to do is to have a dialogbox displayed if the user enters more than 1 characters into a textfield.
My aim here is to be able to pass across a title, label and select which buttons to have displayed - a generic dialogbox! (and if this isn't do able then use a normal window and pass across the needed parameters)
thus i would pass across these values ('Too many characters',1,'Please enter only ONE character!')
this would then display a dialogbox .. Title of would be 'Too many character'
1
button would be display with Okay as it's text Label message would be 'Please enter only ONE character!'
Thus i could have the same dialogbox displayed with 2 buttons for example and test on a Yes or No action by pasing 2 across.
OR have frames that are visible or not.
Now having set the senerio my problem currently is that i cannot get the dialog box to appear from my main program! that is i type in 2 characters - Nothing happens no dialogbox and when i close the program I get an error message refering to the fact that there is no method in my dialogbox event code for the method called.
so here is the code of my current dialogbox, and below that are some sample calls to get the dialogbox to be displayed.
require 'monitordxlog' #foxGUI generated code for the dialogbox
class Mondialog < DialogBox
def initialize(p,
app) super create end
def create @dialogBox.show end def init #create @button5.connect(Fox::SEL_COMMAND){ @dialogBox.close
} end end
#unit test if __FILE__==$0 require 'libGUIb16' app=FX::App.new w=Mondialog.new app w.topwin.show(Fox::PLACEMENT_SCREEN) app.create
app.run end
Now if i was to execute/run the program above it WILL display the dialogbox and upon clicking
the button it will be closed - SO IT WORKS as a standalone program!!
from my main program i do this
require 'monitordxlog_evnts' < name of the file for code above
In the initialize method create a class variable for the object to be held with
@dialog = Mondialog |
the above line is wrong. you are assigning the class Mondialog instead of an object of class Mondialog. Right would be something like this:
@dialog = Mondialog.new @topwin
hth,
-- henon
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users