Third soft button for LWUIT/Codenameone?

76 views Asked by At

I am attempting to add a central button to my CodenameOne project via code, I already add two commands that provide specific behaviour.

I have managed to see the third soft button when doing:

Display.getInstance().setThirdSoftButton(true);

Which gives a contextual command based on the component from what I can see. What I am aiming to have is the contextual behavior when possible but allow the current form to override the button and provide its own functionality.

So there are two questions:

How do I maintain the behavior of my two current commands and prevent them from moving left or right or losing order. And also how do I override the contextual button to provide my own command regardless of the current focused component?

1

There are 1 answers

3
Shai Almog On BEST ANSWER

This is a really old feature that dates back to LWUIT and the original Nokia 3 button phones so it might have regressions.

Generally to customize the command text you can just invoke setSelectCommandText on the specific component. When the select command is invoked on a component the method fireClicked is invoked on that component, if you want to change the behavior you can override that method.