Display a dialogbox from another program

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

Display a dialogbox from another program

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

then when i want it to be displayed I do this
       @dialog.create

I get this error

>ruby mymainwin.rb
mymainwin.rb:17:in `init': undefined method `create' for Mondialog:Class (NoMethodError)
    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 mymainwin.rb:52:in `run'
    from mymainwin.rb:52
>Exit code: 1

If i use new, open, show,exeute, run i get the same message different undefined method name shown.

I know it's my lack of understanding ruby and FXruby so would appreciate some help with this.

Now to show that i'm not been trying ..

I have now altered the dialogbox code to this...

require 'monitordxlog'

class Mondialog < DialogBox

  def create
    super
    @dialogBox.show
  end
 
  def init  
        @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

and when i try to get it to display on screen via
           @dialog   << no other parameters etc

I get NO ERRORS but i also get no dialogbox appearing!!

Now as another test i created a normal window and tried to get it to get it to appear on screen by callign it with show, run, execute, load ( load @dialog) all giving me the same errors as i have shown above for teh dialogbox issue - namely no methods found!.

assistance would be greatly appreciated as i DO try a lot of things myself and search before posting any calls for help.

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: Display a dialogbox from another program

by Meinrad Recheis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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