Android Question xCustomListView - EditText within not firing focus changed

Rusty

Well-Known Member
Licensed User
Longtime User
In post #14, I asked if one could put EditTexts in the xCustomListView.
In fact, you can :)
I have added rows of "items" into the clv that contain panels which contain a label and an EditText view.
It is important to my application that when the EditText gains/loses focus that I suppress the soft keyboard with IME and then show my own custom keyboard.
When the EditText is touched the FIRST time, this works great :)
If you exit the EditText (change focus to something else), the custom keyboard disappears as appropriate, but when you touch the same EditText to regain focus, the Focus Changed event does NOT fire...
However, the soft keyboard does pop-up...
When you touch the soft keyboard, the Focus Changed event then DOES fire...
Am I doing something wrong? When I load the CLV, I load a .bal file with the EditText defined within...
Any ideas are welcome...
Rusty

UPDATE: The Focus Changed event does not fire when you touch the soft keyboard, it is the TextChanged event...
FURTHER UPDATE: I updated Erel's example and placed an edittext within the .Bal file. It generated the CLV with the label, button, chechbox and edittext views as planned.
When I touch the edittext, the hasfocus fires. If i touch any other edittext, the hasfocus fires, if i touch a button, checkbox or label, the hasfocus does NOT fire.
Is there a way to make the focus change when another type view is touched?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note that your question is not related to CustomListView.

if i touch a button, checkbox or label, the hasfocus does NOT fire.
Most views do not capture the focus.

Why is the focus important for you? Do you want to hide the keyboard?
A good solution is to set ForceDone to true and handle the EnterPressed event. Another option is to add a "submit" button next to the text field and hide the keyboard with IME library.
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
  • User touches the EditText;
  • the hasfocus fires;
  • i hide the softkeyboard with IME;
  • I show my custom keyboard;
  • they finish typing;
  • I hide my custom keyboard;
  • they touch the EditText again
  • the hasfocus event does NOT fire.
Yes, the has focus event is important. I don't want the softkeyboard and do want my custom one.
thanks
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Like @Erel says capture the click events on views that don't get the focus like buttons and do the hide keyboard routine. Not sure how you get the focus off the edittext then back onto it.
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
You are a genius! Thanks Erel.
I didn't know there was a CLICK event.
This seems to work well for me.
Thanks!
Rusty

Ricky,
I put a "hide keyboard" button function on my custom Enter key. Also, my button click events hide the keyboard since they don't need it.
Thanks for the post:)
 
Upvote 0
Top