How to draw text with white spaces in blackberry.? - blackberry

I am in big trouble,I want to draw text on the image.I insert string from EditField and when i enter string which is wrapped or you can say it contains new line character.but when i get string from editfield using edifield.getText() it convert that string in to single line. But actually i want string like it is in editfield.
For example in edit field i insert string like this:
Hi,
How are you?
Then editfield.getText() gives me "Hi,How are you?".
So how to get original text for editfield?
Please Help me to solve this problem.

Here is the ans ,how to draw multiline text:
http://supportforums.blackberry.com/t5/Java-Development/Can-drawText-wrap-text-into-multiple-lines/td-p/258808

Related

How to get coordinates of an highlighted text in Eggplant

I have a text box, the size will change, using Ctrl+a I have highlight the text in the text box, how to get the coordinates of this highlighted text? so that I can readtext() that area. Actually I tried copying the highlighted text to clip board and then to put in a variable. But if I compare with an existing text I am getting an \n for the end of the line, if I compare the text retrieved with original text , they don't match. so I am thinking of using readtext()
Please help me in this regard.
Can you try with format function. Should get rid of escape sequences.
typeText controlKey&a
typeText controlKey&c
put remoteClipboard() into yourVariable
put format("%b", yourVariable) into newVariable
Reference link: SenseTalk
how are you comparing in your scenario?
When your use "contains" in your condition you can achieve what you have expected.

How can i start this remain text underneath it's upper text in UILabel?

I want to show remain text of line underneath it's upper line in UILabel. How can i do that? I used UILabel for to show this text and i set Lines = 0. Any help would be greatly appreciated.
cell.Describtionlabel.text = "Intelligient Keyboard Engine (IKE™) \n\t- When typing up IKE will give you suggestions and ideas. \nDictate \n\t- We also have audio mode which allows you to dictate your report and we type it up for you.\nSelf Transcribe\n\t- If you wish to type up yourself just select self transcribe as your delivery option."
Check for the alignment, set label alignment to left,
Check if there is any initial space when you are setting the text to your label.If yes, remove that.
This will solve your issue.
User Swift Multiline String Literals
From the Doc
Multiline String Literals
If you need a string that spans several lines, use a multiline string literal—a sequence of characters surrounded by three double quotation marks:
let quotation = """
The White Rabbit put on his spectacles. "Where shall I begin,
please your Majesty?" he asked.
"Begin at the beginning," the King said gravely, "and go on
till you come to the end; then stop."
"""

Flush edges when setting NSBackgroundColorAttributeName for attributed string

I have an NSAttributedString, part of which is highlighted using the NSBackgroundColorAttributeName property.
But this is what the final output looks like
I want the color to be flush to the sides of the page so there's no white space before when the text starts and after it ends.
You could try something like below...
If that is the only attributed string you'd be using then, you could set background color
of the UI Object(UILabel, UIButton...).
But I beleive that you're using more than one attributed strings merged, In that case
You could prefix and suffix your string with new line character
"\n".
DISCLAIMER:
This will comprise a new line at the top and bottom along with your attributed string.

Drawn text highlighting. Core text? Something other?

I want to draw highlighted parts of text, but I haven't any ideas, how can I do it.
Result, which I want:
Caption on image is one attributed string, where I'm finding hashtags and drawing it in blue color. Nickname in header - one simple NSString. I want to show rects, and text, which user wants to find. Have you any ideas, how I can find CGRects for NSRanges in my drawn string?
PS: I want to detect coordinate of last character for other image works.

BlackBerry non-wrapping LabelField

I have a label field and 3 edit fields. I want characters entered in the label field to be on one line. Can anybody tell me how to do this?
You can check the length of the string using Font.getDefaultFont and call the function stringWidth passing in your label string. If the text is wider then the screen (use Display.getWidth), either make the font smaller or trim it to the size.
Another option is to implement your own field but that seems far more work... :)

Resources