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
Contributor
Posts: 11
Registered: ‎01-30-2012
My Device: device field.
My Carrier: device field.

ChatField with Emotions

Hi ,

 

Can anyone give an idea to develop a ChatField with Emotions. I tried with customized chat field by extending Editfield using paint methed , but its not working. 

 

protected void paint(Graphics graphics) {
// TODO Auto-generated method stub

if(bitmap!=null){
X = Font.getDefault().getAdvance(this.getText());

if(X < Display.getWidth()){
Y = 0;
}
else{
Y = X/Display.getWidth(); 
}


graphics.drawBitmap(X,Y, bitmap.getWidth(), bitmap.getHeight() , bitmap, 0, Y); 

drawHighlightRegion(graphics,Field.HIGHLIGHT_SELECT, true, X, Y, bitmap.getWidth(), bitmap.getHeight());
drawFocus(graphics, true);



}


super.paint(graphics);
}

 



 

 

 

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ChatField with Emotions

you can use the search to find lengthy discussions about it.
i have used a customized field, it works okay-ish, but has some issues with selection etc.
I have asked RIM several times how to do it, but there is no API to draw emoticons.
----------------------------------------------------------
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
Contributor
Posts: 11
Registered: ‎01-30-2012
My Device: device field.
My Carrier: device field.

Re: ChatField with Emotions

Could you please send your customized field code
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: ChatField with Emotions


bhanuprakashachary wrote:
Could you please send your customized field code

Most probably it's not his code - it is his company's intellectual property, so he is not allowed to send it. If you are well-versed in BlackBerry low-level programming, do the search Simon suggested and see if what is discussed there makes any sense.  Even if it does, it will still be an extremely non-trivial task.

 

Personally, I doubt extending EditField is correct here. Extend Field instead and create your own layout and paint as well as keyChar, setCursorPosition, select, drawFocus, getFocusRect etc. Your layout should make all the word-wrapping, while paint should deal with the symbol->emoticon substitution, cursor and selection area highlighting.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ChatField with Emotions

i don't have all the functionality arkadyz mentions, and it took me a good week to have it all working. if you have the time to spare, take it on, otherwise i would think about not displaying emoticons, much easier.
----------------------------------------------------------
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