Lostfocus event

Hello
I am using LostFocus event on a textField on webVersion and i am changing textfield with the Button TAB and sometimes the event does not work , but then i just click with the mouse on another textfield it works 100%.
Why this is happening ?
And what i can do to work with the TAB key?

Can you create a sample project that reproduces the problem?
I don’t like the ‘sometimes’ part, is that frequent? random?
What Xojo version?
What platform are you building?
Is this happening when you debug, when you deploy or both?
Can you create an issue with your code and a video showing the problem?

if ivMode = 1 And me.Text = “?” then
Var txt as String

Try
Var rs as Rowset = Session.db.selectSQL(“select isNULL(MAX(ersh_code),‘’) as ersh_code FROM E_RET_SHOP”)
if rs <> Nil and not(rs.AfterLastRow) then
Var maxCode as String = rs.column(“ersh_code”).stringValue
Var parts() as String = maxcode.split(“”)
var numericPart as String
var numericPartCount as Integer = 0
for i as Integer = parts.ubound to 0 step -1
if parts(i).isNumeric then
numericPart = parts(i)+numericPart
numericPartcount = numericPartcount+1
else
exit
end if
next
Var num as Integer = numericPart.tointeger
num = num+1
Var newCode as String = maxcode.left(maxcode.length-numericPartcount)+num.tostring
me.text = newcode
return
else
me.Text = “1”
Return
end if
Catch e as SQLErrorExceptionMBS
System.DebugLog(e.message)
me.Text = “”
Return
End Try
end if

this the code
it is frequent
my version is 2023r1.1
web app
and it happes either debugging neither deploy

Try to create a sample project that Xojo can use to reproduce the problem and create a case in https://xojo.com/issues

That way @Ricardo_Cruz can take a look at this.

It is important that lostfocus (FocusLost) is 100% reliable.

1 Like