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
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700
Accepted Solution

setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi All,

 

Is there anybody meets this issue?

 

I want to display some particular text on the top of screen when screen is first launched.

 

I use Manager.setVerticalScroll to implements my goal.

 

However, if VerticalFieldManager adds an ActiveRichTextField and the ActiveRichTextField holds too much information.

setVerticalScroll will not work any more.

 

Screen will always display the content from first added to the screen.

 

Here is my test source, my test environment is OS 4.6.0 bold simulator and device.

 

 

/* * PositionTest.java * * © <your company here>, 2003-2008 * Confidential and proprietary. */ import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.UiApplication; /** * */ public class PositionTest extends UiApplication{ public static void main(String args[]) { UiApplication app = new PositionTest(); app.enterEventDispatcher(); } PositionTest() { AMainScreen screen = new AMainScreen(); pushScreen(screen); screen.setPosition(); } class AMainScreen extends MainScreen { private VerticalFieldManager v1 = new VerticalFieldManager(Manager.VERTICAL_SCROLL); private VerticalFieldManager v2 = new VerticalFieldManager(Manager.VERTICAL_SCROLL); private VerticalFieldManager m = new VerticalFieldManager(Manager.VERTICAL_SCROLL); public AMainScreen() { super(); for(int i=0;i<1;i++){ HorizontalFieldManager hfm = new HorizontalFieldManager(); hfm.add(new LabelField("Test :")); v1.add(new ActiveRichTextField("This is a long ",Field.FOCUSABLE)); } m.add(v1); for(int i=0;i<1;i++){ HorizontalFieldManager hfm = new HorizontalFieldManager(); v2.add(new LabelField("This is a long message,This is a long message,This is a long message,This is a long message,", Field.FOCUSABLE)); //v2.add(new ActiveRichTextField("This is a long message,This is a long message,This is a long message,This is a long message,", // Field.FOCUSABLE)); } m.add(v2); add(m); } public void setPosition() { m.setVerticalScroll(v1.getHeight()); } } }

 

 

Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

No body meets this problem?

 

:9

Highlighted
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi,

 

Try using setTitle() of mainscreen to set a particular text on the top of the screen

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi,

 

Did you were able to solve the issue.

 

You are using HorizontalFieldManager but not adding this manager on screen.

 

 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Thanks, I am so sad to say, I am unable to solve this issue.

 

There is a mistake on HozizantalFieldManager on my test source code.

 

But it does not affect my issue.

 

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi,

 

If you want to show a particular String always on top of screen then why are you not using MaScreen class setTitle().

 

can you please clear your problem little more 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi ,

 

Thanks for reply so quickly.

 

what I want to do is a little similar with RIM message application.

 

I have already setTitle()

 

for example: when you first open a message on RIM message.

 

The Firstline always show From, when you scroll up, message status or received time field will show up,

 

otherwise, it will be hidden always.

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi,

 

I think i got your problem

 

try adding all your componment in a verticalfield manager and set style of this vertical field manager "Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR"

 

Now add this verticalfield manager on your mainscreen.

 

Please let me know if it helped you or not.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Thanks, I have tried it already, today I have tried it again.

 

still no lucky.

 

 

here is my new test code:

 

/* * PositionTest.java * * © <your company here>, 2003-2008 * Confidential and proprietary. */ import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.math.Fixed32; /** * */ public class PositionTest extends UiApplication{ public static void main(String args[]) { UiApplication app = new PositionTest(); app.enterEventDispatcher(); } PositionTest() { AMainScreen screen = new AMainScreen(); pushScreen(screen); screen.setPosition(); } class AMainScreen extends MainScreen { private VerticalFieldManager v1 = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); private VerticalFieldManager v2 = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); private VerticalFieldManager m = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); public AMainScreen() { super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); setTitle("Position testing"); for(int i=0;i<1;i++){ //HorizontalFieldManager hfm = new HorizontalFieldManager(); //hfm.add(new LabelField("Test :")); //hfm.add(new ActiveRichTextField("This is a long ",Field.FOCUSABLE)); //v1.add(hfm); v1.add(new ActiveRichTextField("This is a long ",Field.FOCUSABLE)); } m.add(v1); for(int i=0;i<1;i++){ // if LabelField, it works fine. //v2.add(new LabelField("This is a long message,This is a long message,This is a long message,This is a long message,", // Field.FOCUSABLE)); // if message is short, it works fine // v2.add(new ActiveRichTextField("This is a short message", Field.FOCUSABLE)); // too long message, it will does not work. v2.add(new ActiveRichTextField("This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,", Field.FOCUSABLE)); } m.add(v2); add(m); } public void setPosition() { m.setVerticalScroll(v1.getHeight()); } } }

 

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: setVerticalScroll will not work if ActivaRichTextField with mutil-line Text.

Hi,

 

I am mentioning below a code snippet and please let me know wether it worked as you wanted or not

/* * VerticalManagerScreen.java * * © <your company here>, 2003-2008 * Confidential and proprietary. */ import net.rim.device.api.ui.container.VerticalFieldManager; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.component.ActiveRichTextField; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.component.LabelField; /** * */ class VerticalManagerScreen extends MainScreen { VerticalFieldManager objVfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); VerticalManagerScreen(){ objVfm.add(new ActiveRichTextField("This is a long",Field.FOCUSABLE)); objVfm.add(new LabelField("This is a long message,This is a long message,This is a long message,This is a long message,This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,", Field.FOCUSABLE)); objVfm.add(new ActiveRichTextField("This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,This@is.com 4169232900 http://a.long.message,This is a long message,This is a long message,This is a long message,", Field.FOCUSABLE)); add(objVfm); } }

NOTE: Please change the text according to your requirement

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish