Use Glade to select the File/Open menu item, which will be named imagemenuitem2
(note that you are free to change the name of any item by typing the new name into the ID: entry on the General tab for that item.
Let's do so, and change this to the more meaningful name: file_open
(as usual, no quotes).
Now select the Signals tab, and set the activate handler to be open_file
(ok, so I'm not being very original, too bad :p)
Click the Save the current project toolbutton, and run your program again. In the terminal you should see something resembling:
---------------------------------------------------------------------
-- Undeclared function in /home/irv/demos/examples/glade/test1.glade
---------------------------------------------------------------------
-----------------------------------------------------------------------
global function open_file()
-----------------------------------------------------------------------
return 1
end function
You should have expected that. Copy this template, paste it into your Eu program,
and fill in the blank. You'll also have to be sure to add
include GtkFileSelector.e
to the top of your program (right after include GtkEngine.e).
include GtkEngine.e
include GtkFileSelector.e
add(builder,"~/demos/examples/glade/test1.glade")
main()
-----------------------------------------------------------------------
global function help_me()
-----------------------------------------------------------------------
Info(,,"About","My fine program!")
return 1
end function
-----------------------------------------------------------------------
global function open_file()
-----------------------------------------------------------------------
display(fileselector:Open("*.ex"))
return 1
end function
Click on a file, and you should see the filename and path displayed on your terminal.