B4J Question [SOLVED] [ABMaterial] ABMInput Changed Event doesn't work

Xandoca

Active Member
Licensed User
Longtime User
Hi,

It seems that ABMInput changed event doesn't work (old thread). Is there any workaround or solution?

Thanks
 

Harris

Expert
Licensed User
Longtime User
How did you implement it?
Some source code...

I used it to force CAPS to all input in a field.
This is not a good approach since it hits the server with every key stroke.
There are better ways...
 
Upvote 0

Xandoca

Active Member
Licensed User
Longtime User
Thanks Harris. Bellow the code.

B4X:
Sub Page_ParseEvent(Params As Map)
    
    Dim eventName As String = Params.Get("eventname")
    Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))
    
    Log(eventName)
    ...
end sub

public Sub ConnectPage()
    ...

    Dim inputtaxahora As ABMInput
    inputtaxahora.Initialize(page,"inputtaxahora",ABM.INPUT_TEXT, loc.Localize("taxahora"),False,"")
    
    ...
    
end sub

Sub inputtaxahora_Changed(value As String)
    Log (value)
end sub

Never reach log(value) at sub inputtaxahora_Changed

Log shows only gotfocus and lostfocus events:
inputtaxahora_gotfocus
inputtaxahora_lostfocus

Never shows inputtaxahora_changed

Regards.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
B4X:
    Dim casesummary As ABMInput
    casesummary.Initialize(page, "casesummary", ABM.INPUT_TEXT, "Summary", False, "lightblue")
    'casesummary.InputMask = ABM.INPUT_TEXT.ToUpperCase
      'casesummary.RaiseChangedEvent = True

I had to raise the event... ( 'casesummary.RaiseChangedEvent = True )
This worked badly when typing into the input, since it went back to the server and sent back the uppercase text... It would actually miss keystrokes due to the latency of travel back and forth...
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Yes, Changed is a very costly event. I can believe what Harris says in his case of uppercase as this would even require a .refresh with every keystroke.

One way to do it could be by using B4JS. See the B4JS tutorials series for that. (search for B4JS on the forum and read them all).
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
since I have never used
I must say, I probably have used it only in one project myself. In most cases, this is not needed at all. I do all my checks of inputs once the user presses Enter. Plenty of time to do all the checks and show warnings/messages to users then. This is how most websites do it too. You can color e.g. them red if they are wrong.
 
Last edited:
Upvote 0
Top