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
bbman
Posts: 20
Registered: ‎06-01-2009
My Device: Not Specified
Accepted Solution

how to dehighlight manager

Hi, I'm sorry if this issue has been asked before, but I have searched this forum and read the tutorials but still couldn't find how to solve it.

 

I'm trying to make a screen populated with rows, and when each row is in focus, I want the whole row to be highlighted (kind of like how the whole row is highlighted in mail as we scroll down). Note that each row is a horizontal row manager. Now the thing is, even though I've set it in the constructor for the horizontal row manager to be HIGHLIGHT_FOCUS, the manager still doesn't highlight itself during onFocus() event. Therefore I manually changed the background color of the manager to emulate highlight effect (if there is a method to do highlight fields or manager, please tell me). However, now I don't know how to put it back as it was before.

 

Here is how I code the row:

HorizontalFieldManager row = new HorizontalFieldManager(Field.FIELD_LEFT | Field.FOCUSABLE | Field.HIGHLIGHT_FOCUS | Field.HIGHLIGHT_SELECT){
           
            protected void sublayout(int maxWidth, int maxHeight){
                super.sublayout(475, 50);
                setExtent(475, 50);
            }
           
            protected void onFocus(int direction){
                setBackground(BackgroundFactory.createSolidBackground(Color.MIDNIGHTBLUE));
            }
           
            protected void onUnfocus(int direction){
                //dont know what to do. Tried invalidate() but doesnt work

           }
        };

 

Thank you very much in advance to whoever can guide me

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: how to dehighlight manager

This is probably a dumb question, but why are you trying to invent this when you already have ListField and/or ObjectListField that does the same thing - and it's already written for you?

 

 

Please use plain text.
Developer
bbman
Posts: 20
Registered: ‎06-01-2009
My Device: Not Specified

Re: how to dehighlight manager

Well, I'm making the look of the row to be very similar to the search app screen in the appworld client. So I'm going to put an icon, and then a text right beside the icon, so I naturally thought of making a horizontal manager and just adding image field and label field, and plus the last time I used ObjectListField was to make a dropdownbox. Ok, so if I understand this correctly, I should insert each row with a horizontal manager I just described above, and it will take care of the highlighting for me, right?
Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: how to dehighlight manager

You can implement this using ListField, and implementing your own drawListRow.

 

If you absolutely insist in doing this from scratch, I have done this by creating a custom implementation of Field, where I manage and paint the list rows individually. Not that big of a deal, I don't think. I've had to do this to create really custom list rows with multiple text/graphics elements within each row.

 

I've never tried what you are attempting here, but I guess it should be possible.

 

 

Please use plain text.
Developer
bbman
Posts: 20
Registered: ‎06-01-2009
My Device: Not Specified

Re: how to dehighlight manager

Ah sorry I haven't finalized this post in such a long time. You're right rex, I did end up using drawListRow with the help of another colleague and it worked beautifully.
Please use plain text.
New Developer
ankbb
Posts: 35
Registered: ‎01-10-2010
My Device: 8310 and 9000
My Carrier: no idea

Re: how to dehighlight manager

Hi,

 

I am totally new to BlackBerry Java development and facing a similar kind of problem..I could not find the actual solution after reading this post.

 

My problem goes like this :

 

I have the parent container as a VerticalField Manager(vfm) whose paintBackGround(Graphics) method fills the background with colorA(say)

Then I have written a for loop within which  :

     I am creating another instance of VerticalField Manager(vfm1) which is further composed of FlowFieldManager.

     Thus I create a series of rows within the for loop.

 

I want that on taking the focus to a particular row, the row should get highlighted/repainted with a tinch/tone of colorA,
keeping the text intact.

 

I tried writing the onFocus() , onUnFocus() , paintBackGround() methods, but could not get the correct results.

 

Can you please guide me on this or provide me some code /links on this.

It would be a great help.

 

I quick help would be really appreciated.

Thanks in Advance.

 

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to dehighlight manager

I would recommend that you start a new Thread rather than extend a solved Thread,  People don't look at solved Threads (unless they want the solution of course).

 

Anyway, is you question answered in this Thread?

http://supportforums.blackberry.com/t5/Java-Development/Creating-a-highlight-effect-on-a-horizontalF...

 

If not, I suggest you start a new Thread.

Please use plain text.
New Developer
ankbb
Posts: 35
Registered: ‎01-10-2010
My Device: 8310 and 9000
My Carrier: no idea

Re: how to dehighlight manager

Hi Peter,

 

Many thanks for such a quick response. I really appreciate.

Would surely put all my requests and your replies on a separate thread.

 

But currently, since I am short of time, I tried using the code provided in the above link.

 

However , I got error on the BackGround and BackgroundFactory gave resolution error as I have no such classes defined in my workspace.

Is it manadatory to work this way. If not, what kind of code do I need to put in these classes.

 

Please help as I am a total newbie to BlackBerry Java development.

 

Thanks.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to dehighlight manager

Please start a new Thread.

 

Remember that it is important to you that people actually look at and respond to your Thread.  People are not going to look at this Thread because it is solved.  In addition, the subject does not match your question, so someone that know something about what your real question is about, but is not interested in dehighlighting, is not going to look at this Thread.  So staying on this Thread is not gong to get you as good an answer as starting a new Thread.

Please use plain text.