Question

i'am trying to build a GUI in shoes. But i cannot open a new window when i click on a button. please help.When i click the file button i want to open a new window which will have more buttons.

the code is :

Shoes.app(:width => 500 ,:height => 500) do 


@File =  button "FILE"  , :width => 80 , :height => 30  do
    window :title => 'new window' ,:width => 300 ,:height => 300 do
    para "hello"
    end 

end 
@File.move(300,100)

@fileimage = image 'instagram.png' , :width => 50 , :height =>50 
@fileimage.move(220,100)

@Options = button "OPTIONS" , :width => 80 , :height => 30 do 
    alert "options button"
end
    @Options.move(300,170)

@optionsimage = image 'cog2.png' , :width => 50 , :height =>50 
@optionsimage.move(220,160)

@help = button "HELP"  , :width => 80 , :height => 30do 
    alert "Help button"
    end

@help.move(300,230)

@helpimage =image 'Dzone-Logo-Square-Webtreatsetc.png',:width => 50 , :height => 50
@helpimage.move(220,220)

@about = button "ABOUT" , :width => 80 , :height => 30   do 
    alert "About button"
    end

@about.move(300,280)            

@aboutimage =image 'thumbs-up.png',:width => 50 , :height => 50
@aboutimage.move(220,280)



end
Was it helpful?

Solution

Here is an example for green shoes

require 'green_shoes'

Shoes.app title: "The Owner" do
   button "Pop up?" do
     window do
       para "Okay, popped up from #{owner}"
     end
   end
 end

OTHER TIPS

You could put an app in a function and call it from a button click

require "green_shoes"
def window1
    Shoes.app do
        @a = button "click me"
        @a.click do
            window2
        end
    end
end
def window2
    Shoes.app do
        para "Window 2"
    end
end
window1

If you want to reference variables in the first window use the owner object. As the second window is called by the first it is the owner and you can pass information via the owner object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top