genie enter & display gtk

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
JohnM34
Posts: 2
Joined: Mon 19 Jul 2010, 08:48

genie enter & display gtk

#1 Post 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

JohnM34
Posts: 2
Joined: Mon 19 Jul 2010, 08:48

#2 Post 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)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#3 Post by technosaurus »

Uses
Glib
Gtk

here are examples:
http://code.valaide.org/category/tags/genie
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#4 Post 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.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Post Reply