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
49
50
51
52
53
|
dalosp.textview = {
get_settings = function (self)
return { }
end,
input_change = function (self)
local h = self:get_linked_input(1)
if h then
self.extra.txt.value = h:readfile()
else
self.extra.txt.value = ""
end
end,
activate = function (self)
self.extra.dlg:show()
end,
create = function (d, tab, settings)
tab.ninputs = 1
tab.noutputs = 0
tab.otype = dalos.objtype.LUA_VIEWER
tab.activate = dalosp.textview.activate
tab.input_change = dalosp.textview.input_change
tab.default_name = "Text View"
tab.ntype = "Text View"
tab.get_settings = dalosp.textview.get_settings
local extra = { }
local obj = dalos.object(d, tab, extra)
local txt = iup.text {
multiline = "Yes",
readonly = "Yes",
expand = "Yes",
font = "Courier, 8"
}
local dlg = iup.dialog {
txt,
size = "320x200",
title = obj.name,
shrink = "Yes",
}
extra.dlg = dlg
extra.txt = txt
return obj
end,
}
dalos.textview = dalosp.textview.create
dalos:register_obj("Text View", dalos.textview, "Basic Viewers")
|