Thank you. I should find the actual control (internal of element written in 
code) then disable its focus.


And the focus problem occurs not always, but often start at dialog on my 
system. That's troublesome to reproduce I think. Let it go.


Best,
Lin


--------


 The  IUP(canvas) is inside the sbox. sbox itself can not receive focus. You 
must retrieve the internal control to be able to disable its focus:

local text=iup.text{value='test'}
s = iup.sbox{canfocus='NO',text,}
h = iup.GetChild(s, 0)
h.canfocus = "NO"
print(h)
iup.dialog{
 iup.hbox{s},
 startfocus=text,
 k_any=function(self,c)
  if c==iup.K_F1 then
   print(iup.GetFocus())
  end
 end,
}:show()



Best,
Scuri





Em seg, 17 de set de 2018 ??s 10:49, ???? <robert...@qq.com> escreveu:

Hi,
Initial focus is at dialog in my test. And after Tab, focus is switch between 
the two internal controls.


Another demo with new problem:


local iup=require'iuplua'
local text=iup.text{value='test'}
iup.dialog{
 iup.hbox{iup.sbox{canfocus='NO',text,},},--Not work.
 startfocus=text,
 k_any=function(self,c)
  if c==iup.K_F1 then
   print(iup.GetFocus())
  end
 end,
}:show()
iup.MainLoop()
Focus order on Tab is:
IUP(dialog): --unexpected
IUP(canvas):--unexpected 
IUP(text): 
IUP(canvas): 
IUP(text): 
..
Which can't disable 'canfocus' of 'iup.sbox'.


------------------ ???????? ------------------
 "antonio.scuri"<antonio.sc...@gmail.com>;
2018??9??14??(??????) ????1:11
 "IUP discussion list."<iup-users@lists.sourceforge.net>;

Re: [Iup-users] Attribute "startfocus" of dialog not work



 No, in Lua it is not necessary to use a string name.

 I just run your sample code and it is working. I'm using exactly the same 
configuration (from the original 3.25 distribution). I tested on lua53.exe, 
iuplua53.exe and iupluascripter53.exe.


 I also changed t for b, and the focus went to the button as expected.


Best,
Scuri







Em qui, 13 de set de 2018 ??s 12:13, ???? <robert...@qq.com> escreveu:

Demo:
require'iup'
b=iup.button{title='x'}
t=iup.text{value='y'}
iup.dialog{iup.vbox{b,t},startfocus=t}:show()--Not necessary to use a string 
name?
iup.MainLoop()

Lua 5.3, iup 3.25, Win10 64bit.
_______________________________________________
 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

Reply via email to