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
New Contributor
armando220587
Posts: 4
Registered: ‎09-09-2010
My Carrier: Movistar
Accepted Solution

ActiveRichTextField Focus problem

Hi There! 

 

 i create a custom layout manager with labelfields, bitmapfields and activeRichTextFields to display information from a list of Tweets... i use activeRichTextFields to show the content of the tweets and i need to highlights the URLs, the activeRichTextField works fine there, but when i move up to move between Tweets the field lose focus on a few words 

it looks like..

Please use plain text.
Administrator
MSohm
Posts: 14,074
Registered: ‎07-09-2008
My Carrier: Bell

Re: ActiveRichTextField Focus problem

Have you implemented custom focus behaviour here? What field is accepting focus in each row?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Contributor
armando220587
Posts: 4
Registered: ‎09-09-2010
My Carrier: Movistar

Re: ActiveRichTextField Focus problem

the activeRichTextField is accepting the focus...

 

here is the code:

 

public static void paintMainTwitter(VerticalFieldManager topManager,ControlComp cc) {
		try {
			Token token = new Token("consumer_token","consumer_secret");
			Credential c = new Credential("userAccount",
					"consumerKey","consumerSecret", token);
			UserAccountManager m = UserAccountManager.getInstance(c);

			if (m.verifyCredential()) {
				SearchDevice s = SearchDevice.getInstance();
				Query q = QueryComposer.from("noticias24");
				Tweet[] twts = s.searchTweets(q);
				try {
					topManager.add(new NullField());
					for (int i = 0; i < twts.length; i++) {

						Tweet tweet = twts[i];
						LayoutManager lm = new LayoutManager(Color.WHITE,
								Color.ORANGE);

						Font font_Bold = Font.getDefault().derive(Font.BOLD,cc.cel.getFontD());
						LabelField name = new LabelField(
								tweet.getString(MetadataSet.TWEET_AUTHOR_NAME)
										+ " ");
						name.setFont(font_Bold);
						
						Font font_twitt = Font.getDefault().derive(Font.PLAIN,cc.cel.getFontH());
						ActiveRichTextField text = new ActiveRichTextField(
								tweet.getString(MetadataSet.TWEET_CONTENT));
						text.setFont(font_twitt);
						
						HorizontalFieldManager hfm = new HorizontalFieldManager();

						VerticalFieldManager vfm = new VerticalFieldManager();

						final Bitmap bm = cc.resize(EncodedImage
								.getEncodedImageResource("logo.gif"));
						BitmapField foto = new BitmapField(bm,
								BitmapField.NON_FOCUSABLE) {
							protected void layout(int width, int height) {
								setExtent(bm.getWidth() + 1, bm.getHeight() + 1);
							}

						};
						hfm.add(foto);

						vfm.add(name);
						vfm.add(text);

						hfm.add(vfm);
						lm.add(hfm);

						topManager.add(lm);
						topManager.add(new SeparatorField());

					}

				} catch (Exception e) {
					LabelField lb = new LabelField(e.toString());
					topManager.add(lb);
				}
			}else{
				topManager.add(new LabelField(""+m.verifyCredential()));
			}
		} catch (Exception e) {
			topManager.add(new LabelField(e.getMessage()));
		}
	}

 

 

 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,074
Registered: ‎07-09-2008
My Carrier: Bell

Re: ActiveRichTextField Focus problem

What is the text contents of the ActiveRichTextField? Does it contain all text after the bolded LabelField (text with white and orange background)? If so do you want it to be orange or white?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Contributor
armando220587
Posts: 4
Registered: ‎09-09-2010
My Carrier: Movistar

Re: ActiveRichTextField Focus problem

hello...

the text content of the ActiveRichTextField is indeed all the text after the bolded labelfield and i want it in orange 

 

about the colors, here is a picture with the secuence of the error 

 

 

detail carefuly where the cursor is...i just move it up in the secuence.

 

i just want  to keep the orange background in all the field with focus, no matter where the cursor is

 

sorry for my english...

Please use plain text.
Administrator
MSohm
Posts: 14,074
Registered: ‎07-09-2008
My Carrier: Bell

Re: ActiveRichTextField Focus problem

I see what you mean.  Could you post a self contained code sample?  The one above has reference to many custom classes.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Contributor
armando220587
Posts: 4
Registered: ‎09-09-2010
My Carrier: Movistar

Re: ActiveRichTextField Focus problem

i was not able to fix this bug for SO 4.6, but the same code is working pretty well in the SO 4.7 or above! 

Please use plain text.