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
Regular Contributor
Posts: 61
Registered: ‎08-11-2010
My Device: Not Specified
Accepted Solution

creating Suggest Box Field

Hi All,

          I am trying to develop a SuggestBox Field using the 4.5 API. I read a Thread where Peter had a discussion about this. But there was not much of implementation discussion on it and it couldn't help me much. So trying to start a new one that in the would help us get a full fledged reusable suggestbox Field. Here is what I do. (Please tell me if there is a better approach).

 

* I am extending a TextField.

* And in fieldChangeNotify() Iam trying to draw a rectangle that would cotain a list of values that i give it. Then I have to implement the navigation movement across the values and the onClick Event should feed the value to the TextField.

 

My problem here is, I am not sure as to how to repaint the box with the rectangle (the box should come over the screen just like Google search Field). I am taking a TextField because, this Suggestbox should actually allow the users to type inn values that are not in the list. Your valueable inputs please.

Thanks

Developer
Posts: 216
Registered: ‎02-18-2010
My Device: 9350,8520
My Carrier: no

Re: creating Suggest Box Field

use invalidate() method for repainting.

Regular Contributor
Posts: 61
Registered: ‎08-11-2010
My Device: Not Specified

Re: creating Suggest Box Field

thanks for the quick reply aman. But how do I pass inn the new graphics for painting again? I dont have a provision for that. As far as I can see, when the user types inn a value, I have to redraw the field again with the rectangle section. I am not sure as to how I redraw it. Conventionally, I suppose invalidate would call the paint() again and it will paint the same text field. how do i come over this?

Developer
Posts: 216
Registered: ‎02-18-2010
My Device: 9350,8520
My Carrier: no

Re: creating Suggest Box Field

you do this in screen paint method by apply the condition according to textfield input 

Regular Contributor
Posts: 61
Registered: ‎08-11-2010
My Device: Not Specified

Re: creating Suggest Box Field

Thanks aman.