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
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

Use of undocumented API's on the Blackberry

[ Edited ]

Hey everyone,

I wanted to know, what is the status of undocumented API's on the blackberry?

 

I want to use TextField.autoSelectFullText(). It works well, but isnt documented.

What are the risks? is there an alternative to using this message to select all the contents of a TextField?

Message Edited by omri on 08-18-2008 12:57 PM
Please use plain text.
Administrator
MSohm
Posts: 14,434
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Use of undocumented API's on the Blackberry

Undocumented methods should not be used.  They can change or be removed at any time.

 

Can you describe what you are trying to accomplish?  With that we may be able to provide an alternative option.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
simon_hain
Posts: 16,019
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Use of undocumented API's on the Blackberry

Can you describe what you are trying to accomplish?


i would guess that he wants to select all the text in a field :smileyhappy:
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Administrator
MSohm
Posts: 14,434
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Use of undocumented API's on the Blackberry

This can be done by calling setCursorPostion(0), then calling the select method and passing in true and then calling setCursorPostion again and passing in the text length.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Use of undocumented API's on the Blackberry

[ Edited ]

like this?

 

fEditField.setCursorPosition(0);
fEditField.select(true);
fEditField.setCursorPosition(EditField.getTextLength());

 

because it dosnt work.

it just puts the cursor at the end.

 

I checked it now with just  fEditField.select(true); 

calling this method didnt enter select mode. 

Message Edited by omri on 08-18-2008 01:02 PM
Please use plain text.
Administrator
MSohm
Posts: 14,434
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Use of undocumented API's on the Blackberry

Yes that should work.  I tried it in the BlackBerry Simulator included in the version 4.5.0 BlackBerry JDE.  What version are you using?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Use of undocumented API's on the Blackberry

[ Edited ]

i use the eclipse plugin, JDE 4.3.

for backwords compatability reasons.

 

i have the JDE 4.6 Beta installed, Ill check if it works with that for me. 

Message Edited by omri on 08-18-2008 03:03 PM
Please use plain text.
Administrator
MSohm
Posts: 14,434
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Use of undocumented API's on the Blackberry

I tried it in the version 4.3.0 BlackBerry JDE and it worked there as well.  In my test, I was overriding the keyChar method of EditField to execute the same code if a specific key was pressed.

 

From where are you trying to call this code from?  Does the field have focus at the time (required to select)?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Use of undocumented API's on the Blackberry

I'm doing this within the constractor for my class.

Before calling it i call field.setFocus()


 fEditField= new EditField("Name: ", strName);

add(fEditField)

 

if (selectTitle)
{

    fEditField.setFocus()
    fEditField.setCursorPosition(0);
    fEditField.select(true);
    fEditField.setCursorPosition(fCardName.getTextLength());
    //fEditField.autoSelectFullText();
}

 

 and i tried on 4.6 beta and that didnt work too...

any idea? 

Please use plain text.
Administrator
MSohm
Posts: 14,434
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Use of undocumented API's on the Blackberry

First push the screen that contains the EditField, then perform your selectTitle code block.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.