Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question regarding CustomItem

 
Punit Raizada
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a Class that extends the CustomItem class in MIDP 2.0.

What my CustomItem implementation has:
- It has a Image and a string clubbed together into one item. ( This part is done. It displays on the Form. I can traverse to my Custom Item on the phone when the Form is displayed).

What i want to do ?
- When the user navigates ( traverses) to my CustomItem and hits the Select Key i would want to change the current display. To accomplish this i believe i have to use the method.
Now, The javadoc says that the interaction modes supported by the CustomItem will depend on the phone. I can query if the phone supports a particular interaction mode by calling the method.

I know its possible that the phone might not support the KeyPressed method but does anyone have any experience with this ???
 
Derek Clarkson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, not familiar with MIDP2 in this area so take this into account with these comments.

it sounds to be like you are effectively trying to re-create some sort of a button or label which reponds to a key event. I have built a cutom API for the company I work for based around MIDP1. I worked with a series of custom classes which are added to a canvas and the canvas then notifies them of events which are appropriate for them.

During this process I've built two different versions of a button. The first one is assigned a specific game key code during setup. this is registeed with the form when the button is added to it. When the user releases this specific button, the form tells the button which in turn tells all listeners which have registered with it. The listener class is ones I have written which simply has a single click(MyButton myButton) method.

The other method I have used is to have my form track the control which has focus. This is usually highlighted to the user. Thus when the user releases a button the event is automatically sent to the control which currently has focus, triggering the listeners again, etc. The form of course has code in it for asking the controls if they will allow focus to shift in a specific direction and then shifting it to the next control.

As far as the interaction modes are concerned. From my reading of the doco, I would suggest this is a way for the system to tell a control what sort of internactions it supports and that this is only necessary in some circumstances where you somehow want to make use of system based prompts, etc. If you are wanting to load your own custom screen in response to a click type event, I would simply just use the button release event to do a setCurrent() to set the new screen. I cannot see from my reading why you would need to worry about interaction modes.

ciao
Derek.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic