Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange
Accepted Solution

menu button options no appearing with BasicEditBox.

Hi I'm developing an application that has Popup screen with a a BasicEditfield.

My problem is with users that have a SureType keyboard - I want them to be able to switch to multi-tap on some fields instead of the auto-complete. I know i can force this with a 

TextField.NO_COMPLEX_INPUT, but i want the user to be able to change it dynamically and by his choice. 

 

Usually ( For example in the native browser ), clicking the menu button opens options such as Change Language, and more importantly Switch To MultiTap. But in my applcation clicking the Menu Button does nothing, when my Editbox Popup-Screen is open. 

 

So - Is there any way to show these options to the user?

 

Thanks,

Dan. 

Please use plain text.
Developer
NiceNix
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: menu button options no appearing with BasicEditBox.

[ Edited ]

I had to add menu items to the BasicEditField before and simply used an override to the makeMenu() method to add the items I wanted. ... however I have never been stuck with having no menu come up at all.  Have you somehow suppressed the menu?  The code I used was very simple as below ... you just need to have your menu item hide itself if the currently focussed field is not a basiceditfield:

 

 

private final MenuItem m_closeItem = new MenuItem("Close", 200000, 10)
{
    public void run()
    {
        onClose();
    }
};

protected void makeMenu(Menu menu, int instance)
{
    if (menu.getSize() > 0) 
    {
        menu.addSeparator();
    }
    menu.add(m_closeItem);
} 

 

 

 

 

MenuItem m_closeItem = new MenuItem("Close", 200000, 10)

    {
        public void run()
        {
            onClose();
        }
    };
    protected void makeMenu(Menu menu, int instance)
    {
     // super.makeMenu(menu, instance);
    
        if (menu.getSize() > 0) 
        {
            menu.addSeparator();
        }
        menu.add(m_closeItem);
        
    }  

 

Please use plain text.
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange

Re: menu button options no appearing with BasicEditBox.

Thanks for answer.

I guess i'm so how suppressing it. 

But is there no way to get the default EditBox options?

Please use plain text.
Developer
NiceNix
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: menu button options no appearing with BasicEditBox.

I'm not familiar with the multi-tap vs SureType commands, but for the Storm there is a Show Keyboard / Hide Keyboard command that is associated with all textboxes.  I imagine it works the same way for multi-tap.  To access show keyboard, all I did was add a textbox to my screen ... I didn't have to do anything special, a working menu was the default behaviour.

 

Have you tried playing with any of the sample apps in the developer zone?  I have found that they all have the menu working.  You may want to take a look there for a starting point.

 

Good luck!!

Please use plain text.
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange

Re: menu button options no appearing with BasicEditBox.

I will try, thanks

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: menu button options no appearing with BasicEditBox.

I note you seem to have a popup screen.  A Popup Screen will normally not have a menu and I think the default PopupScreen does not provide a way of creating one.  However it is possible, and then you can add the Context Menu Items from the EditField.  I think you will have to make the menu and show it yourself.  Is this what you want?

Please use plain text.
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange

Re: menu button options no appearing with BasicEditBox.

[ Edited ]

Hi, Thanks Peter, Helpful as always :smileyhappy:

 

Anyway, your advice got me somehow in the right direction - Indeed i am using a popup screen, so to make the menu appear i added 

DEFAULT_MENU in the Screen constructor, 

and overrided makeMenu :

 

public void makeMenu(Menu menu, int instance)  

{        

   super.makeMenu(menu, instance);  

}

 

Works perfectly now! I get the wished for Switch language, Switch to Multi-tap, Clear field, etc. options. 

Please use plain text.