Need some help to handle menu bars

7 messages - 1337 views

Hi there,

I'm trying to understand how to handle Menus and Menubars "programmatically" with Kuix but can't find any documentation/forum thread dealing with that. In addition to that,it seems like changes were made since the last time I practiced Kuix (which is almost a good thing by the way ;-)).

So anyway, could anybody give me an advice/a snippet to manage the bottom left and right menus on a "brand-new instanciated" Screen object ? I need the right one to be a "back" button and the left one to display a popup menu with one or two entries.

 

Cheers guys

Screen Menus instances (fistMenu and secondMenu) are instanciated by the screen itself the first time you invoke the getter.

        // Create the screen
        Screen myScreen = new Screen();
        
        // Create the firstMenu
        Menu myFirstMenu = myScreen.getFirstMenu();
        myFirstMenu.add(new Text().setText("Back"));
        myFirstMenu.setOnAction("myBackAction");
        
        // Create the secondMenu
        Menu mySecondMenu = myScreen.getSecondMenu();
        mySecondMenu.add(new Text().setText("Menu"));
        
        // Create the MenuPopup instance
        MenuPopup mySecondMenuPopup = mySecondMenu.getPopup();

        // Create and add popup items
        MenuItem myMenuItem1 = new MenuItem();
        myMenuItem1.add(new Text().setText("Item1"));
        myMenuItem1.setOnAction("myItem1Action");
        mySecondMenuPopup.add(myMenuItem1);

        // Display the screen
        myScreen.setCurrent();

Great, it works perfectly, thank you.

What are the getInternalMenus used for by the way ?

Screen.getInternalMenu() are used internaly to get the "Validate" and "Cancel" menu displayed when you open a MenuPopup.

Ok, I think it's a little bit clearer for me now...Thank you very much

Kuix is really a good project but I think there's a huge amount of "documentation work" remaining to do. What about setting up a space where anybody could post "must be known" snippets. I think that forum.nokia.com where a Wiki is available for each programming language, offering this thematic kind of resources would really improve the developper community around this fmk ;-)

 

> What about setting up a space where anybody could post "must be known" snippets. I think that forum.nokia.com where a Wiki is available for each programming language, offering this thematic kind of resources would really improve the developper community around this fmk ;-)

Yes, we are currently thinking about to add this feature.

If you need somebody to manage some dev/admin/moderation stuff on this idea, maybe I could help ;)