iOS Question Show Hide TopRightButtons Items

abhishek007p

Active Member
Licensed User
Longtime User
How do I Show and Hide TopRightButtons Items?

in my scenario.
I have a multiline TextView, when keyboard opens it covers most of the control, there is no way to go back, the done button on textview works as enter key. so I am displaying a Done button on top right toolbar.

when the user click Done button I close the keyboard, then I want to hide this Done button. and show again when the textview gets focus. I also want to display a button/image item when keyboard is not open.

Thanks
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can add a button above the keyboard: https://www.b4x.com/android/forum/threads/input-accessory-views.51000/#post-318960

You can remove and add buttons to the TopRightButtons at runtime. If you like to hide or show the buttons you can do something like:
B4X:
Dim buttons As List = NavControl.TopRightButtons
NavControl.TopRightButtons = Array()
'later you can return the buttons with:
NavControl.TopRightButtons = buttons
 
Upvote 0

abhishek007p

Active Member
Licensed User
Longtime User
Sorry, i dont understand. can you post a simple working example?

Many questions like How to i define what type of button/item i want to set, how to handle events, set its text or image etc.

This code crashes the app
B4X:
Page1.TopRightButtons.Initialize
Page1.TopRightButtons = Array("Done1", "Done2")

in my scenario, i have a textview and
When Keyboard is visible - i want to Display a Done button
When Keyboard is not visible - i want to Display a Image Based Button
 
Upvote 0
Top