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

New Developer
Posts: 1
Registered: ‎06-16-2009
My Device: Not Specified

Repaint problem in PopupScreen when using BasicEditField and SureType.


I have a PopupScreen (painted over a custom Canvas) that contains a BasicEditField and two ButtonFields (for OK and Cancel). I'm letting the system create the border for this PopupScreen, and it looks great until I start typing in the text field with SureType. As I type, the list of SureType choices pop up over the borders of the PopupScreen and end up causing it to paint incorrectly. Once I have made the SureType selection, the focus goes back into the edit field, but 3/4ths of the PopupScreen border are gone and do not get repainted

I've tried adding focusListeners and changeListeners, invalidating the screen when called, but this only partially solves the problem. I'm not doing anything custom here, so I'm wondering why I need to monitor this at all and request a repaint for the screen. Shouldn't it just work?

Platforms: 4.5 (8130) and 4.6 (8230). Works fine in 4.7 (9350).
Thanks for any help!


public final class TextEntryPopup extends PopupScreen { /** Ok button. */ private ButtonField m_okButton; /** Cancel button. */ private ButtonField m_cancelButton; /** Entry field. */ private BasicEditField m_entry; /** Centered Cancel button. */ private HorizontalFieldManager m_buttons; /** * Construct popup and its fields. * * @param item target item * @param listener action to call when text entry is done (used when url is * not specified) * @param url target url * @param urlProcessor processor */ public TextEntryPopup( final TextEntry item, final FilterListener listener, final String url, final UrlProcessor urlProcessor) { super(new VerticalFieldManager()); final String text; if (item != null) { text = item.getText(); } else { text = null; } createUI(text); } /** * Create entry field and ok / cancel buttons. * * @param startText default text for entry item */ private void createUI(final String startText) { m_buttons = new HorizontalFieldManager(); m_okButton = new ButtonField(ResourceUtil.getUIString( UIResource.MENU_OK)); m_okButton.setChangeListener(new FieldChangeListener() { public void fieldChanged(final Field field, final int context) { final String text = m_entry.getText(); // do something hide(); } }); m_buttons.add(m_okButton); m_cancelButton = new ButtonField(ResourceUtil.getUIString( UIResource.MENU_CANCEL)); m_cancelButton.setChangeListener(new FieldChangeListener() { public void fieldChanged(final Field field, final int context) { hide(); } }); m_buttons.add(m_cancelButton); m_entry = new BasicEditField(Field.EDITABLE | Field.USE_ALL_WIDTH); m_entry.setFocusListener(new FocusChangeListener() { public void focusChanged(Field field, int eventType) { invalidate(); } }); m_entry.setChangeListener(new FieldChangeListener() { public void fieldChanged(final Field field, final int context) { invalidate(); } }); m_entry.setText(startText); add(m_entry); add(m_buttons); } /** * Handle trackball click events. (prevent menu from appearing). * * @see net.rim.device.api.ui.Screen#invokeAction(int) * @param action action to monitor * @return true on trackball click */ protected boolean invokeAction(final int action) { boolean handled = super.invokeAction(action); invalidate(); if (!handled) { switch (action) { case ACTION_INVOKE: // Trackball click. return true; default: break; } } return handled; } /** * Prevent the save dialog from being displayed. * * @see net.rim.device.api.ui.container.MainScreen#onSavePrompt() * @return true to skip save prompt */ public boolean onSavePrompt() { return true; } /** * Hide the screen. */ private void hide() { Ui.getUiEngine().popScreen(this); } }