forked from gerito1/vala-gtk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrybuffer.vala
48 lines (36 loc) · 1.04 KB
/
entrybuffer.vala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* The EntryBuffer object provides a way to store text held in an Entry, with
* functionality for handling the text and sharing to other Entry widgets.
*/
using Gtk;
public class Example : Window
{
private Entry entry;
private EntryBuffer entrybuffer;
public Example()
{
this.title = "EntryBuffer";
this.destroy.connect(Gtk.main_quit);
var grid = new Grid();
this.add(grid);
unowned uint8[] text = (uint8[]) "Entry with EntryBuffer";
entrybuffer = new EntryBuffer(text);
entry = new Entry();
entry.set_buffer(entrybuffer);
grid.attach(entry, 0, 0, 1, 1);
entry = new Entry();
entry.set_buffer(entrybuffer);
grid.attach(entry, 0, 1, 1, 1);
entry = new Entry();
entry.set_buffer(entrybuffer);
grid.attach(entry, 0, 2, 1, 1);
}
public static int main(string[] args)
{
Gtk.init(ref args);
var window = new Example();
window.show_all();
Gtk.main();
return 0;
}
}