summaryrefslogtreecommitdiff
path: root/iup/srclua5/radio.lua
blob: 7af65403a7830d6e1d5ffbd5e99d1b5feaa0e136 (plain)
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
------------------------------------------------------------------------------
-- Radio class 
------------------------------------------------------------------------------
local ctrl = {
  nick = "radio",
  parent = iup.WIDGET,
  creation = "I",
  callback = {}
} 

function ctrl.SetChildrenNames(obj)
  if obj then
    if obj.parent.parent == iup.BOX then
      local i = 1
      while obj[i] do
        ctrl.SetChildrenNames (obj[i])
        i = i+1
      end
    elseif obj.parent == iup.FRAME then
      ctrl.SetChildrenNames (obj[1])
    else
      iup.SetHandleName(obj)
    end
  end
end

function ctrl.createElement(class, param)
   ctrl.SetChildrenNames(param[1])
   return iup.Radio(param[1])
end
   
iup.RegisterWidget(ctrl)
iup.SetClass(ctrl, "iup widget")