diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/skang.lua | 10 |
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'} |
1032 | thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'} | 1032 | thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'} |
1033 | widgets.W{'Cwidget', 'The widget.', types='userdata'} | 1033 | widgets.W{'Cwidget', 'The widget.', types='userdata'} |
1034 | widgets.W{'action,a', 'The action for the widget.', 'nada', types='string'} | 1034 | widgets.W{'action,a', 'The action for the widget.', 'nada()', types='string'} |
1035 | widgets.W{'text,t', 'The text for the widget.', '', types='string'} | ||
1035 | local aIsValid = function (self, parent) | 1036 | local 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 |
1044 | end | 1048 | end |
@@ -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 |
1100 | end | 1106 | end |