BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-27-2007, 06:10 AM   #1 (permalink)
New Member
 
Join Date: Oct 2007
Location: Barcelona
Model: many
PIN: N/A
Carrier: many
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Use BB menu on trackball with Canvas?

Please Login to Remove!

Hi,

I'm porting a Midlet (based on Canvas) to BB. No big problem, except I don't manage to get the BB menu style (primary vs fullmenu) with the menu key and cursor key.

As I understood (i'm newbie in BB API), I MUST use a Screen (from the BB API) to get the fancy BB menu. Right?

In order to achieve this, I try to create ONE GLOBAL invisible MainScreen which will call the correct Canvas to create the menu / paint the UI. The first part work fine.

The problem, is that: How to paint the canvas ?

So, I override the MainScreen.paint(). to clean the background (this works fine). Then, comes the real problem!


I was hopping to just "pass" the graphics to the canvas. but BB use an other class (with the same name).

So, somebody know how to:
- get the BB menu on a normal Canvas? (javax.microedition.lcdui.Canvas)
- Paint a normal Canvas from a MainScreen.paint() ?
- get a valide javax.microedition.lcdui.Graphics inside MainScreen.paint() ?
- an other way to achieve this?

any help / direction is more than welcome,

thanks in advance,

Loda

PS: I found some post talking about Manager. But, as I understood the doc, this does not really help me.
Offline  
Old 11-29-2007, 08:55 AM   #2 (permalink)
New Member
 
Join Date: Oct 2007
Location: Barcelona
Model: many
PIN: N/A
Carrier: many
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well,

since I did not found a way, and look like nobody got any ideas,

I made a menu class for canvas and use the KeyListener class to catch the menu key.

don't look the same as the BB menu, but at least i can open a menu on the cursor/menu key.

I'm still intressed in any other solution (the canvas menu solution is kind of ugly)
Offline  
Old 01-14-2008, 10:06 PM   #3 (permalink)
New Member
 
Join Date: Jan 2008
Model: 8707g
PIN: N/A
Carrier: Engneer
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I have the same problem, can you tell me how to use the KeyListener to catch the menu key?

Thank you very much!
Offline  
Old 01-15-2008, 03:52 AM   #4 (permalink)
New Member
 
Join Date: Oct 2007
Location: Barcelona
Model: many
PIN: N/A
Carrier: many
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

@dmks:

1. implement KeyListener
2. register it
Application.getApplication().addKeyListener(this);

3. in public boolean keyDown(int keycode,int time){
return true when you want to process the key event your self.

4. don't forget the keyRepeat / up event.

5.
public static int BB_MENU_KEY = 268566528;
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.