Central Button Soft key LWUIT

2019-06-25 04:32发布

问题:

This might seem like a very trivial problem but I have spent quite some time on this without finding a viable solution.

Nokia devices have a central select button,which allows us to assign soft keys to it.

According to my requirement, I need to assign a specific command as the soft key. For instance it might be "Play" on one screen and "Select" on other. Note that I have a default select command already set using:

setDefaultCommand((Command) v.elementAt(v.size() - 1));

which is always the first command in the menu at the right and is invoked when central select button is pressed.

From what I read, the way commands are assigned to each soft key is very arbitrary and varies from device to device. Since I have a default command already set, my problem can be solved in two ways:

1.By setting a soft key to the central button using

Display.getInstance().setThirdSoftButton(true);

I tried this, but the way commands are assigned is very random. Also,there is a default command "Select" always added to the menu. Is there a way to customize this so that a very specific command is shown above the central button?

2.By just assigning a label so that the default command set as above is displayed in the central soft key.

回答1:

The 3rd softbutton mode has default implementations for many focusable components but not for labels. You can customize its label by invoking setSelectCommandText(String) on the component.

I suggest that rather than using a label for a center command just use a button and set it's UIID to Label if you want it to appear as a standard label.