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
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Cursor Position on EditField

No, never had to do this.  Even if I could make a font, it would not be colored so I don't think that is the answer. 

Developer
Posts: 33
Registered: ‎10-29-2010
My Device: Not Specified

Re: Cursor Position on EditField

@peter_strange did you know how to show cursor/caret and able to move the cursor position freely if u move your navigation in read only text field on OS6 and above?
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Cursor Position on EditField

As I mentioned early on in this Thread, replacing the EditField with something of your own is a tricky proposition and one which I have never taken on. 

Developer
Posts: 33
Registered: ‎10-29-2010
My Device: Not Specified

Re: Cursor Position on EditField

but i use the standard field from API, and the caret never appear if the field is on focus and in read only mode, but it will on os5
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Cursor Position on EditField

This is different question to the one that is being discussed on this Thread.  Please start your own Thread.

 

I have not seen this as an issue, so please post a snippet that demonstrates the problem when you start your own Thread. 

Developer
Posts: 33
Registered: ‎10-29-2010
My Device: Not Specified

Re: Cursor Position on EditField

Trusted Contributor
Posts: 141
Registered: ‎02-15-2012
My Device: 9800
My Carrier: Airtel

Re: Cursor Position on EditField

Please use the following code:

 

protected void onFocus(int direction) {
if (VirtualKeyboard.isSupported())
// Show keyboard
getScreen().getVirtualKeyboard().setVisibility(VirtualKeyboard.SHOW);
this.setCursorPosition(this.getTextLength());
invalidate();
super.onFocus(direction);
};

protected void onUnfocus() {
if (VirtualKeyboard.isSupported())
// Hide keyboard
getScreen().getVirtualKeyboard().setVisibility(VirtualKeyboard.HIDE_FORCE);
this.setCursorPosition(this.getTextLength());
invalidate();
super.onUnfocus();
};

 

It is working for me.