06-16-2011 05:28 AM
can u show me ur code?
06-16-2011 05:42 AM
06-16-2011 05:57 AM
i run ur code in simulator 9000 which works fine.
06-16-2011 05:59 AM
yes its runs fine but not showing cursor to show that Edit field has focus nd ready to input text
06-16-2011 06:56 AM
In my opinion, responses on this Thread show some misunderstandings about specifying the size of a Field and especially the way layout is used. I recommend that you all review this KB article for more information on this process.
http://supportforums.blackberry.com/t5/Java-Develo
Remember when you call super.layout, you are actually asking the Field to lay itself out - but you can restrict the dimensions that it uses, but that is really all you can do. Once you have called super.layout, you need to respect the extents that it has decided upon.
So for example, I believe that this is incorrect:
public void layout (int width, int height)
{
super.layout (width, height);
if (getExtent().height < getPreferredHeight())
super.setExtent (width, getPreferredHeight());
}
What you should do is this:
public void layout (int width, int height)
{
super.layout (width, getPreferredHeight());
}
And I think this is also wrong:
protected void layout(int width, int height)
{
width = this.width;
height = this.height;
super.layout(width, height);
super.setExtent(width, height);
}
In this case, you should accept the extents the Field has decided for you within the constraints you have given it. If you are not going to, then what is the value in calling super.layout?
If you are painting the Field yourself, then you can ignore super.layout and lay the Field out yourself (which is what the KB article does) but if you are not doing the painting, then you should let the Field decide how to lay itself out so that it can then paint itself correctly.
If you are painting for the Field, then it is your responsibility to all the painting. In other words you have to know when and where the cursor is, if it is selecting and so on, and draw the focus indications. This is not a small undertaking.
Perhaps the OP can restate what they would like to see, rather than focusing on one way to achieve it.
It is possible for example, to restrict a Field's height on the screen by putting in a restricted height VerticalFieldManager - in which case it can scroll within that Manager if it is too big.
So rather than trying to set a specific height for a Field, identify the UI you are trying to achieve and we may be able to find an easier way to do it without rewriting EditField.
06-20-2011 05:57 AM
06-20-2011 06:11 AM
Are you doing this for OS 4.6 and above?
Have you seen the UI Fields in here:
From memory I think there is an EditField that has a Border around the Field which looks quite good and might do what you want too.
06-20-2011 06:16 AM
for os 6.0
06-20-2011 06:21 AM
but this link doent contain implementation of Custom EditField
06-20-2011 07:04 AM