Hi,
Can anybody help me..m trying to overload addCommand(Command) so that I can insert it in my own menu.. but if I do this commandListerner does not listens or say CommandAction is not get called.. what might be the problem..
Thanx
Hi,
Can anybody help me..m trying to overload addCommand(Command) so that I can insert it in my own menu.. but if I do this commandListerner does not listens or say CommandAction is not get called.. what might be the problem..
Thanx
Are you calling the the addCommand() method of the superclass (super.addCommand())?
shmoove
Hi
It seems that you forgot to associate your menu with setCommandListener.
The data provided by you is very less. Can you post some piece of your code ?
This is that method..
public void addCommand(Command cmd){
if(cmdLeftSoftKey == null){
cmdLeftSoftKey = cmd;
}
else if(cmdRightSoftKey == null){
cmdRightSoftKey = cmd;
}
super.addCommand(cmd);
}
I called setcommandListener(this) in the constructor of class.
If I removed super.addCommand(cmd) call it does not listens n if kept it, it invokes system menu...![]()
Hi namrata,
If I got it right I don't think it will work, the registration may be on the implementation code.
Best,
Juarez Alvares Barbosa Junior - Brazil
That makes sense, since super.addCommand() is what will tell the framework that you added a Command.Originally Posted by namrata
What do you mean by "it invokes system menu"? What system menu? And what do you want for it to happen?n if kept it, it invokes system menu...![]()
Also:
When using Commands and the high-level UI you don't have real control over which softkey the Command will be added to. You can try to "influence" it with the Command type you add, but which side it will go is implementation dependent.Code:if(cmdLeftSoftKey == null){ cmdLeftSoftKey = cmd; } else if(cmdRightSoftKey == null){ cmdRightSoftKey = cmd; }
shmoove
Hi shmoove,
"When using Commands and the high-level UI you don't have real control over which softkey the Command will be added to. You can try to "influence" it with the Command type you add, but which side it will go is implementation dependent."
exactly i want to decide that which command will go on which side. isn't it possible?
Not with the high-level UI. The control you have is limited to choosing the appropiate Command type when creating the Command. For instance a Command of type BACK or EXIT will usually go to the right softkey on Nokia phones.
But this doesn't give you complete control: different phones will behave differently, and the number of Commands you add will also affect things.
The only way to decide for yourself exactly which softkey does what is to use a full screen Canvas, and draw the "commands" yourself and handle the softkey presses in keyPressed()/keyReleased() (and then you run into the issue that softkey codes are not standardized).
shmoove