Page 1 of 1

genie enter & display gtk

Posted: Mon 19 Jul 2010, 10:13
by JohnM34
I am trying to learn Genie in Puppy Linux 431 and would like to know if there are any examples on how to use entry and label in gtk to enter, save and display data like strings and integers.
Any help is greatly appreciated

Posted: Sun 08 Aug 2010, 06:10
by JohnM34
I tried this and got this error.

[indent=4]

uses
GLib

entry : Gtk.Entry
label : Gtk.Label

a:string = entry.get_text

def static on_button_clicked ()

label.set_text( a )
init
Gtk.init (ref args)

var window = new Gtk.Window (Gtk.WindowType.TOPLEVEL)
window.set_default_size (400, 50)
window.destroy += Gtk.main_quit
window.set_title("Input")
window.move(100 , 100)

var vbox = new Gtk.VBox(false , 1)
vbox.border_width = 10
vbox.spacing = 10
window.add (vbox)

entry = new Gtk.Entry ()
entry.set_editable(true)
vbox.pack_start (entry, false, true, 0)

var button = new Gtk.Button.with_label("OK")
vbox.pack_start (button, false, true, 0)
label = new Gtk.Label (" ")
vbox.pack_start (label, false, true, 0)

button.clicked += on_button_clicked;

window.show_all ()

Gtk.main ()


# valac --pkg gtk+-2.0 entrytst4_2_1.gs -o entrytst4_2_1
entrytst4_2_1.gs:9.2-9.9: error: Non-constant field initializers not supported in this context
a:string = entry.get_text
^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)

Posted: Sun 08 Aug 2010, 15:52
by technosaurus
Uses
Glib
Gtk

here are examples:
http://code.valaide.org/category/tags/genie

Posted: Sun 08 Aug 2010, 18:23
by tasmod
Don't know anything about the code style above (Genie?) but in gtk get_entry_text is a const char, that's what your error message appears to say. Can't help further, I'm struggling with gtk.