Pop up window

Im trying to make something that when you first open the program it asks
you which one you want to choose. Then you once you click on the button
it opens up that program. how do i do this?

gem install Ruiby

ruiby button(~Hello Mr Nussbaum~) do exit!(0) end

(…continue)

ruiby -width 300 -height 200
"l=list(~File~); l.set_data(Dir.glob ~.~);
buttoni(‘Validation’) {puts l.selection;exit!(0)} "

Or for startup un ruby script :

require ‘Ruiby’

def script(choice="?")
p choice
end

Ruiby.app(:width=> 300, :height=>200, :title=> “Hello”) do stack do
l=list(“Files…”)
l.set_data(Dir.glob “.”)
buttoni(‘Validation’) { script(l.selection) ; exit!(0)}
end end

For the last one, You can do that with (green) shoes too

Regards,

do you know how to do it in visual ruby?

Hi:

I would encourage you to watch the videos at:

Also, you can read the tutorials.

The basic things you would need to do are:

  1. create a new project. This will create a “Hello World” app to start
    with.

  2. Right click on the “MyClass.rb” file to edit the glade file.

  3. Delete the label that says “Hello World” and replace it with a vbox
    with one cell. Keep the name “vbox1”

  4. You code will look something like this:

def show()
load_glade(FILE)
@view = VR::ListView.new(:filename => String)
Dir.glob(“*”).each do |fn|
@view.add_row(fn)
end
@builder[“vbox1”].add(@view)
show_window()
end

If you add a button named “button1” you could write a handler:

def button1__clicked(*args)
#open file here
end

Or you can use the selection method from the listview:

def view__row_activated(*args)
#open file here
end

Again, read the tutorials and watch the videos. It will be easy then.

Good luck,
Eric

okay thank you very much! what is the difference in (*argv) and (*args)?

*argv and *args are exactly the same. They’re just a variable name.
You could just as easily use *var1 or *x.