Here is the script:

require("iuplua")
list =
iup.list{bgcolor=iup.GetGlobal("DLGBGCOLOR"),multiple="YES",["1"]="first
item",["2"]="Second item"}
vb = iup.vbox{list}
dlg = iup.dialog{vb;
size="QUARTERxQUARTER",border="NO",resize="NO",minbox="NO"}--,menubox="NO"}
--dlg:show()

controls = {tostring(list),tostring(vb),tostring(dlg)}

dlg:showxy(400,400)

print(dlg.screenposition,list.position,dlg.clientoffset)

-- Timer to check if any of the elements have focus
local tim = iup.timer{time=10,run="NO"}
function tim:action_cb()
tim.run = "NO"
local fc = tostring(iup.GetFocus())
local match
for i = 1,#controls do
if controls[i] == fc then
match = i
break
end
end
if not match then
print("lost focus")
else
print("focus on",controls[match])
tim.run = "YES"
end
--tim.run = "YES"
end

tim.run = "YES"

if (iup.MainLoopLevel()==0) then
  iup.MainLoop()
end


On Sat, May 2, 2020 at 4:58 AM Milind Gupta <milind.gu...@gmail.com> wrote:

> Hi Antonio,
>             I have this small script which creates a simple dialog. I set
> up a timer to check for focus on any controls in the dialog and print the
> state. What I see is that if I have menubox="NO" then the focus is never
> lost from the dialog when I switch over from the dialog to something else.
> If menubox="NO" is removed then when I switch over to something else then
> GetFocus finds correctly that none of the controls has a focus anymore.
>             Is there a way to test for the focus correctly without having
> any system bar/buttons or border in a dialog?
>
> Thanks,
> Milind
>
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to