Option for hiding the first menu if right soft key pressed

7 messages - 1351 views

Currently Kuix works so that regardless whether another system menu is showing, it will show/execute the other menu when that soft key is pressed. I'd prefer a way to hide the other menu when the soft key is first pressed and then execute the action when it is pressed again..

What I mean by this is that (at least on Nokia phones) the normal way of operation is that the right soft key always cancels the current action. So if a left system menu is showing and I push the right soft key, the left menu closes. And only after I press it a second time, the action associated with the right menu is executed.

It's very distracting in my application, because the right soft key is bound to quit on the main screen and when I'm showing the left system menu I automatically press right soft key to get rid of it. But instead now it executes the quit - action.

I managed to get the behavior I wanted by making the following modifications to FocusManager:

                    // Soft key right
                    case KuixConstants.KUIX_KEY_SOFT_RIGHT: {
                        Screen screen = rootWidget.getDesktop().getCurrentScreen();
                        if (screen != null) {
                            Menu firstmenu = screen.getFirstMenu();
                            boolean process = true;
                            if (firstmenu.getPopup() != null && firstmenu.getPopup().isInWidgetTree()) {
                                firstmenu.hidePopup();
                                process = false;
                            }
                            if (process) {
                                Menu secondmenu = screen.getSecondMenu();
                                if (secondmenu != null) {
                                    secondmenu.processActionEvent();
                                }
                            }
                            return true;
                        }
                        break;
                    }

But I guess it would be prefereable to make this behavior optional.. So any chance of getting this feature to Kuix ?

Or a shorter form of the above:

                            Menu firstmenu = screen.getFirstMenu();
                            Menu secondmenu = screen.getSecondMenu();
                            if (firstmenu != null && firstmenu.getPopup() != null && firstmenu.getPopup().isInWidgetTree()) {
                                firstmenu.hidePopup();
                            } else if (secondmenu != null) {
                                secondmenu.processActionEvent();
                            }
                            return true;

In the past I decided to create the menu system like you can find it on a PC application.

But, I think your right and it is not the best way for mobile use. The best way would be to change the first and second menu labels and actions by "Select" and "Cancel" when a popupMenu is opened. And why not to have a parameter to choose if cancel is left or right.

I think I will take a look at how to simply implement if in Kuix.

 

Else, pure curious question, what kind of application are you creating ?

It's a gps navigation application mainly for use with geocaching. There is already such an application called Geocache Navigator, (http://www.geocachenavigator.com), but as always, it's lacking in features I would like to see so I decided to make my own. It's come pretty far already, thanks to your excellent UI framework. Haven't released anything yet, as I can't decide whether I wish to release the source code or not. The idea was to make it free, but I'm not sure whether I would wan't to release the source code. On the other hand, I currently cannot afford to license your framework, so therefore it will propably be open source.

Nice, I'm happy to see that Kuix could be usefull to elarge mobile application creativity ;)

Else, I heard you again, and I decided to implement my proposition of switch menus to "Select" and "Cancel" when a popup is opened ( like it works on a lot of mobile applications ... ). And I added an attribute on the screen to determine if the FirstMenu is left or right, because the "select" is always on the firstMenu.

Cool, excellent! You really have first class support, and you seem to really listen to feature requests and wishes. Hopefully more people would find your framework, as currently it seems that I'm almost the only one on these forums :)

Arf, for the moment, your feature requests are justified and in some case it correspond to an internal need to.

Else, you can checkout current release development sources there and it would be great to report bugs.

Else if you like Kuix, the best thing to do is to communicate this informations to other J2ME developpers ;)