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
Trusted Contributor
avi_yach
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Custom Editfield problem

Hello all,

 

I am using the custom editfield from the above link. Problem is I am not able to move the cursor after 7 characters. I tried overriding navigationalMovement method, but it is not entering into the method. One more problem with the above implementation is, if text size is more than 7 characters the paint method is conitnously called as settext method is called.Help of any sort is appreciated.

 

http://blackberry-tips-bikas.blogspot.in/2009/07/writing-custom-textbox-in-blackberry.html

 

A Y.

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Custom Editfield problem

how about contacting the author?
----------------------------------------------------------
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
Developer
kanaksony
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Custom Editfield problem

Hi,

 

There is a call to ef.setText() inside paint(), which causes a re-paint. anad as piant() is called again a call ef.setText() is invoked. So  the paint method is called conitnously. 

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Trusted Contributor
avi_yach
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Re: Custom Editfield problem

kanaksony, thanks for your reply, that was of great help! That helped me confirm my say. Since the paint method is called continously, when I tried to override navigationalMovement and set the cursorposition manually, the position is not accepting it.

 

Is there anyother way to solve it?

 

A Y.

Trusted Contributor
avi_yach
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Re: Custom Editfield problem

Simon_hain, thanks a lot for your reply, sure, I should contact the author once I go back home. Some security filters is stopping me from posting in the blog.

 

A Y.

Developer
kanaksony
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Custom Editfield problem

It will be better if you write custom class yourself rather than this complex code, you will find lots of simple sample source code on the forum which will help you in this... 

 

Check this :

 

http://supportforums.blackberry.com/t5/forums/searchpage/tab/message?filter=location&location=forum-...

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Custom Editfield problem

There are a couple of very basic extensions of EditField in the knowledge base:

TextBoxField revisited

Scrollable one-line text input field

Both articles have comments which expand on their ideas. Take a look and see what you can use. They might not fully satisfy your needs, but are a great food for thought.

 

One of the things I would definitely change there is to use setBorder for border stuff instead of painting the border directly with drawRect/drawLine. The articles were written back when many developers had to support OS 4.2; these days, you can count on having 5.0 at least, which includes all those wonderful field decorations.

 

If doing setBorder, make sure you use the form with visual and updateLayout (which, if all borders have the same dimensions, should be false) - this way you pre-set the borders for different field states (not in focus; in focus, etc.) and the framework takes care of the visual bells and whistles.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!