Hi, I was able to reproduce your problem here.
If I try to run it from inside IupLuaScripter, it won't work either. Except if I click on the IupLuaScripter window which is a window of the same application with decoration. Sometimes it does work and the focus is nil. But most of the time it does not. GetFocus returns the last element that had the focus in IUP, it is not a system call. The element that had the focus must be notified of a killfocus in order to GetFocus returns NULL. It seems that elements in the dialog with this configuration are not being notified of a killfocus. I tried to debug but WM_KILLFOCUS is not even sent. Sorry this seems to be a system behavior because the window does not have decorations. Best, Scuri Em sáb., 2 de mai. de 2020 às 19:07, Milind Gupta <milind.gu...@gmail.com> escreveu: > Windows 10 > > On Sat, May 2, 2020, 2:21 PM Antonio Scuri <antonio.sc...@gmail.com> > wrote: > >> Hi, >> >> Which system? >> >> Best, >> Scuri >> >> >> Em sáb., 2 de mai. de 2020 às 09:23, Milind Gupta <milind.gu...@gmail.com> >> escreveu: >> >>> 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 >>> >> _______________________________________________ >> Iup-users mailing list >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users