Skip to main content

"Invisible" menubar

8 replies [Last post]
gullet
Offline
Joined: 2003-11-17
Points: 0

Hi,

I want a Form with a map to be fullscreen all the time and don't want the menu bar to "steal" any screen space. I'm using the paint()-method to draw the String "Menu" above the LSK, but I want the pressing of it to make the menu show.

How can I best implement this?

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gruelfin
Offline
Joined: 2010-03-11
Points: 0

I have a similar problem.
I have a canvas in lwuit in fullscreen. When I implement the pointerPressed(), pointerDragged() and pointerReleased methods in the canvas, then i cannot press on the menu in the canvas no more (the menubar is invisible anyways).
When i do not implement these methods then i can press on the menu and it works but the menubar in the canvas is invisible before, too.
i want to have the menubar visible in the canvas and i want that when i press on it the menu should appear..

someone knows how to do this?
thanks in advance!

vprise
Offline
Joined: 2003-11-07
Points: 0

This requires LWUIT trunk (newer than 1.4):
Derive MenuBar set the menu bar to your new class in the look and feel.
In your menu bar subclass override installMenuBar to do nothing.

gruelfin
Offline
Joined: 2010-03-11
Points: 0

I have the LWUIT trunk, but i don't really understand what you explained.
I have now:

public class Interface extends MIDlet implements ActionListener {

class myMenu extends MenuBar {
protected void installMenuBar() {
}
}

class canvasForm extends Form {
//code
}

canvasForm canvasForm;

private void showCanvas() {

if (canvasForm == null) {
canvasForm = new canvasForm();
canvasForm.setMenuBar(new myMenu());
canvasForm.addCommandListener(this);
if (backCommand == null) {
backCommand = new Command("Back");
}
canvasForm.setbgColour(bgcolour);
}
canvasForm.show();
if (canvasForm.getCommandCount() == 0) {
canvasForm.addCommand(backCommand);
canvasForm.addCommand(helpCommand);
canvasForm.setBackCommand(backCommand);
}

}

}

When I execute showCanvas() i get a NullPointerException. Can you please give me a bit more details on how to do this?

Thank you very much!

vprise
Offline
Joined: 2003-11-07
Points: 0

<br />
        UIManager.getInstance().getLookAndFeel().setMenuBarClass(MyMenu.class);<br />

<br />
import com.sun.lwuit.MenuBar;</p>
<p>public class MyMenu extends MenuBar {</p>
<p>    // hidden menu bar</p>
<p>    protected void installMenuBar() {</p>
<p>    }</p>
<p>}</p>
<p>

gruelfin
Offline
Joined: 2010-03-11
Points: 0

Thank you very much for your help vprise! I feel a bit stupid because maybe i did not clearly describe my problem.
I want the menu to be VISIBLE and accessible in my canvasform.

The problem is that with touchscreen devices and implemented pointerPressed() method it is not possible to access the menu in the Canvas Form.
Right now it is invisible and when I press on the area where the menu should appear, nothing happens..
The code you posted does not help :(

vprise
Offline
Joined: 2003-11-07
Points: 0

This is much simpler then. Just set softbutton style to have bgTransparency = 0. No code changes or anything and you can do it entirely from the resource editor.

gruelfin
Offline
Joined: 2010-03-11
Points: 0

Ah i got it now,
what solved my problem was to change the paint() method of my canvas form to paintBackground() => the menu is visible now.
i hope to help someone with this =)
thank you vprise!

Shai Almog

Hi,
This was discussed before in the forum with a couple of suggestions.
For this use case you can make the softbutton area completely
transparent and just add an empty command for your menu.

> Hi,
>
> I want a Form with a map to be fullscreen all the time and don't
> want the menu bar to "steal" any screen space. I'm using the paint
> ()-method to draw the String "Menu" above the LSK, but I want the
> pressing of it to make the menu show.
>
> How can I best implement this?
>
> Thanks in advance.
> [Message sent by forum member 'gullet' (gullet)]
>
> http://forums.java.net/jive/thread.jspa?messageID=322315
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]