File: demo-entry-buffer.lua

package info (click to toggle)
lua-lgi 0.9.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: ansic: 5,082; makefile: 169; sh: 31
file content (43 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (7)
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
return function(parent, dir)

local lgi = require 'lgi'
local Gtk = lgi.Gtk

local window = Gtk.Dialog {
   title = "Entry Buffer",
   resizable = false,
   on_response = Gtk.Widget.destroy,
   buttons = {
      { Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE },
   },
}

local buffer = Gtk.EntryBuffer()
local content = Gtk.Box {
   orientation = 'VERTICAL',
   spacing = 5,
   border_width = 5,
   Gtk.Label {
      label = "Entries share a buffer. "
	 .. "Typing in one is reflected in the other.",
      use_markup = true,
   },
   Gtk.Entry {
      buffer = buffer,
   },
   Gtk.Entry {
      buffer = buffer,
      visibility = false,
   },
}
window:get_content_area():add(content)

window:show_all()
return window
end,

"Entry/Entry Buffer",

table.concat {
   "Gtk.EntryBuffer provides the text content in a Gtk.Entry.",
}