Now that I've decided to go ahead and sink my teeth into Cobra, I am trying to adapt the how-to '390-GTK.cobra' (referenced below) to use gtk-sharp3 (GTK+3) and GtkBuilder with a dynamically loaded XML GUI definition. (The XML file was created with Glade 3.14.2 so 'libglade' not required, but I have not included the content of the file here because Gtk::Builder::addFromFile() does not complain. I can though, if needed.)
References:
http://cobra-language.com/how-to/GTK/ ('390-GTK.cobra')
http://docs.go-mono.com/?link=M%3aGtk.B ... ectSignals
https://developer.gnome.org/gtk3/stable ... ct-signals
Here's what I'm using:
- Code: Select all
# cobra --version
# Cobra 0.9.4 on Mono 2.10.9 CLR v4.0.30319 on Mageia 3
Here's the program code ('gtksharp.cobra'):
@args 3.0gtk-sharp-3.0
use Gtk
class ToggleButtons
def main
ToggleButtons().run
def onDeleteEvent(obj, args as DeleteEventArgs)
Application.quit
def onExitButtonEvent(obj, args as EventArgs)
Application.quit
def run
Application.init
gui = Gtk.Builder()
gui.addFromFile('togglebuttons.xml')
gui.connectSignals()
Application.run
And this is what I get when I try to run it:
- Code: Select all
# cobra -d gtksharp.cobra
# gtksharp.cobra(41): error: Cannot find a definition for "connectSignals" in "gui" whose type is "Builder".
# Compilation failed - 1 error, 0 warnings
# Not running due to errors above.
I've noticed that the gtk-sharp method names are in UpperCamelCase (PascalCase?), but Cobra uses lowerCamelCase even for imported libraries. The friendly compiler clued me in to this when I tried gui.AddFromFile:
- Code: Select all
# gtksharp.cobra(40): error: Cannot find a definition for "AddFromFile" in "gui" whose type is "Builder". There is a member named ".addFromFile" with a similar name.
Unfortunately, it isn't giving me any hints for gui.connect.Signals.
Is this a bug, or am I just simply missing something brain-dead-stupid?
Thanks for any help.
T. Lee