aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-18 01:57:28 +1000
committerDavid Walter Seikel2014-05-18 01:57:28 +1000
commit85eaa17d79ce4eb399470a0a20d6dc59f9b07c43 (patch)
tree5f92065ff73944f47236a59f601b23446225c403 /lib
parentGet rid of the last of the artificial delays. (diff)
downloadSledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.zip
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.gz
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.bz2
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.xz
Add widget hide, show, and text setting functions.
Diffstat (limited to 'lib')
-rw-r--r--lib/skang.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/skang.lua b/lib/skang.lua
index 90079ad..e44d4bc 100644
--- a/lib/skang.lua
+++ b/lib/skang.lua
@@ -1031,14 +1031,18 @@ local widgets = {}
1031--thingasm{widgets, 'window', 'The window.', types='userdata'} 1031--thingasm{widgets, 'window', 'The window.', types='userdata'}
1032thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'} 1032thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'}
1033widgets.W{'Cwidget', 'The widget.', types='userdata'} 1033widgets.W{'Cwidget', 'The widget.', types='userdata'}
1034widgets.W{'action,a', 'The action for the widget.', 'nada', types='string'} 1034widgets.W{'action,a', 'The action for the widget.', 'nada()', types='string'}
1035widgets.W{'text,t', 'The text for the widget.', '', types='string'}
1035local aIsValid = function (self, parent) 1036local aIsValid = function (self, parent)
1036 local result = Thing.isValid(self, parent) 1037 local result = Thing.isValid(self, parent)
1037 1038
1038 if result then 1039 if result then
1039 local value = parent[self.names[1] ] 1040 local value = parent[self.names[1] ]
1041 if 'userdata' == type(parent.Cwidget) then
1040--print('NEW ACTION - ' .. self.names[1] .. ' = ' .. value .. ' ' .. type(parent.Cwidget)) 1042--print('NEW ACTION - ' .. self.names[1] .. ' = ' .. value .. ' ' .. type(parent.Cwidget))
1041 action(parent.Cwidget, value) 1043 if ('action' == self.names[1]) and ('nada()' ~= value) then action(parent.Cwidget, value) end
1044 if ('text' == self.names[1]) and ('' ~= value) then text (parent.Cwidget, value) end
1045 end
1042 end 1046 end
1043 return result 1047 return result
1044end 1048end
@@ -1095,6 +1099,8 @@ window = function(w, h, title, name)
1095 win = copy(widgets, name) 1099 win = copy(widgets, name)
1096 local wMum, wThingy = getStuffed(win.W, 'a') 1100 local wMum, wThingy = getStuffed(win.W, 'a')
1097 wThingy.isValid = aIsValid 1101 wThingy.isValid = aIsValid
1102 local wMum, wThingy = getStuffed(win.W, 't')
1103 wThingy.isValid = aIsValid
1098 win.window = Cwindow(caller, w, h, title, name) 1104 win.window = Cwindow(caller, w, h, title, name)
1099 return win 1105 return win
1100end 1106end