Menu in desktop applications made with Codename One - codenameone

I would like to be able to add a menu to a desktop application that I have started to develop. I mean a classic application menu, which on Windows is displayed immediately below the title bar (with items like "File", "Edit", "View", etc.), while on MacOS it is displayed in the top bar common to all applications ("App menu"). Ideally each menu item could invoke an ActionListener, just like tapping a Button.
However, I have not found any information about this and I do not even know if it is possible at the moment. Thank you for your suggestions.

This is a feature we plan to add early on in the 8.0 release cycle as we already make some (minimal) use of it in our own apps. Right now the only option is to use the Swing APIs to add the menus using native interfaces.
You can get all the JFrame instances (of which there can be only one) and add any menu to that. If you use the Mac JMenuBar on a typical Codename One build then it will be on top by default since we set this implicitly through: System.setProperty("apple.laf.useScreenMenuBar", "true");.
You can just add entries to menu bar.

Related

codenameone app with sliding menu

new to codename one, and I'm looking to build a fairly robust app. I've read a lot of codename one documentation and have looked through many of the demos on git. My question is, what is the best way to architect the application?
Here are my basic requirements:
Splash screen
Lock screen (enabled/disabled by user)
Sliding (hamburger) menu
Contents of sliding menu will change based on current 'form'
Application settings
Based on this short list of requirements, would it better to make each different screen a form, and the sliding menu for each a different 'instance', or make a main form that contains the sliding menu (and just change contents of menu based on current screen) and make each different screen a component instead of a form?
Also, I was considering coding it by hand, and not using the gui builder.
Thank you.
Greg
I would go with separate forms mostly because of the hassle of updating the side menu for every selection you make. This would also make the general design more flexible.

Displaying android's commands through code in Codename One

I have an android build of codename one
Can i show the command menu through code in codename one for android build?
Right now , i need to click on the menu option to access the commands. Is there any code snippet through which I can make the commands appear on the screen (invoke the menu) ?
Not at the moment since we don't support showing the native command menu and the command menu might not exist (think ActionBar on Android 3.x and newer).
However, showing the "lightweight" menu might work for some cases. Be warned that this is unsupported officially and this is in no way a recommendation to doing this!
You can call Form.getMenuBar().showMenu(), again this will work great in the simulator but on the actual devices your millage might vary in terms of device look/feel.

How to have multiple windows in one WPF Application?

I'm relatively new to the WPF world and I'm working on an application where I need to have multiple windows in one application. Like Photoshop when the user clicks on "New" button a new window opens and the old existing window(s) goes in the background. The toolbar and the statusbar, however, stay on top, untouched.
I would also like to add the feature that the user can work with multiple windows if each of them is not maximized.
How do I achieve this?
I apologize if I'm a bit unclear in framing my question.
What you are (probably) talking about is an MDI Application. "Unfortunately" WPF does not support that natively. I use quotes because it is more frowned upon in modern UI development than it was in the past.
Instead, the most common "WPF way" of doing this is to open each New window in a new tab in a tab control (like Visual Studio and most web browsers do).
If you really want to do an MDI application, Google search that, but to warn you, it probably means creating your own Window manager.
An alternative is to open non-modal windows, with their ShowInTaskbar property set to false. This gives you the ability to open as many windows as you want, but you lose the ability to contain them within a centralized workspace app.

Silverlight 4 Context Menu: Maintain ability to launch Silverlight Configuration Box

I love being able to add my own context menus to my application but I've run into a bit of a dilemma, how do I override the menu for my entire app (video player) and also provide the user ability to go into the Silverlight Configuration dialog.
For reference I'm talking about the following dialog box
http://msdn.microsoft.com/en-us/library/cc645084%28VS.95%29.aspx
Does anyone know of a way to launch this via code? If there isn't this a bit of an oversight on MS' giving us the ability to do our own context menus. I know with Flash one can add new things into the default right click menu.
Was informed by MS that this is not possible in SL4

How to program Multi Tab Task bar Preview like IE on Windows 7 in WPF?

IE8 on Win7 http://akashkava.com/blog/wp-content/uploads/2009/09/IE8-on-Win7.png
Windows 7 has a new Task bar, and IE can display multiple tabs in the task bar previews, most of programs which does have not implemented this new api only shows one preview, I have an application where I have multiple tabs and I want to show each tab on this preview.
Let me elabourate more on it, I know that every new window created automatically gets a new Window in Switcher, but how to override to use it with tabbed document interface in WPF.
It certainly is possible, you can get familiar with the windows 7 taskbar api, I would recommend starting with the windows 7 taskbar developer resources.
Here is something to get you started! I know this doesn't cover your scenario yet but it is planned in part 2, so keep an I on these:
http://dotnet.org.za/rudi/archive/2009/10/14/anatomy-of-the-windows-7-taskbar-tabbedthumbnail-part-1.aspx

Resources