06-18-2012 05:16 AM
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.
06-18-2012 05:35 AM
06-18-2012 05:37 AM
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.
06-18-2012 05:50 AM
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?
06-18-2012 06:17 AM
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 :
06-18-2012 11:14 AM
There are a couple of very basic extensions of EditField in the knowledge base:
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.