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
samup4web
Posts: 7
Registered: ‎02-01-2013
My Device: Various

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

@Peter, it is actually not the same problem. I tried adding only a TableView on a new MainScreen without banner or setStatus. Just a TableView.

It sets focus on row, and it paints the focused rows (Since I am using FocusPolicy of ROW_FOCUS, I also tried Region and Field). 

 

I read previous posts here and here that relates to this problem. In these posts, it is mentioned that, NullField.FOCUSABLE can ber used. So, I added nullfields with FOCUSABLE bit to all my rows. But still not working. I also added nullField with FOCUSABLE bit to top and end of the manager. but none works.

 

However, in my last post I forgot to mentioned that, this works on 9300 emulator well, but not on the device itself. The scrolling focus never goes out of view in 9300 emulator, but it doens't work as expected in 9800 emulator. 

 

It's my 3rd week on BB development, it's going fine until now. :smileyhappy: Are these bugs on the platform or what? What other option can one use for TableView? seems not many people are using TableView.  

 

I am using BlackBerry JRE 6.0 

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

You are doing very well for 3rd week of BB development!

 

Back to business: indeed, it seems to be a platform problem. Moreover, I have a strong suspicions that MainScreen and not TableView is to blame. If you really need it to work properly, try going with FullScreen and developing your own custom Manager. Just post here a loose description of the UI you are trying to achieve and we will try to work through it together with you.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

Agree witn arkadyz, good job for 3 weeks development!

 

But I'm gonig to disagree with arkadyz here, which is a brave thing to do since he is very good in these things...

 

I think that TableView is broken in this situation.  I think MainScreen is broken too, but has been for years and I think Tableview does not play properly with it.

 

I think if you define MainScreen as I have done in my previous post, TableView will work correctly, so please try that.

Please use plain text.
New Contributor
samup4web
Posts: 7
Registered: ‎02-01-2013
My Device: Various

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

@Peter and @Arkardyz, thanks for the contribution. 

 

I found out the height of the TableView at runtime is more than the display height. It actually takes on the height based on the number of rows. 

 

As Peter suggested in the previous post, puting the TableView in a restricted screen (I used restricted manager instead, because, I keep getting exception when I try to override the subLayout method or setExtent for the MainScreen. Therefore I stick with a Manager) is a solution for this.

 

Also, restricting the height of the TableView itself by overriding it's subLayout method works. In both method, the TableView focus is always on screen and table scrolls as expected.

 

I had to try the second option (restricting height on TableView itself) because I get NullPointerException just before getting the table into focus with the first option(height restriction on containing manager), but the same NullPointerException occurs.

 

The NullPointerException: 

When I have focus on the banner for example, changing the focus to the table using the touch works fine. But when I use the arrowkeys to move the focus toward the table, I get the NullPointerException when the TableView tries to get the focus. The errorlog shows that exception is from TableView(ScrollView).calculateVerticalScrollAmount(XYRect) - line 487, but can't do much with that since, I couldn't view the source.

 

 

 

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

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

"I found out the height of the TableView at runtime is more than the display height. It actually takes on the height based on the number of rows."

 

This is correct if you put in an expanding VerticalFieldmanager.  If you restrict the height, it will play nicely. 

 

"I keep getting exception when I try to override the subLayout method or setExtent for the MainScreen"

 

MainScreen has some special features, you should read arkadyz excellent article about it here:

http://supportforums.blackberry.com/t5/Java-Development/MainScreen-explained/ta-p/606644

 

Regarding your NPE, as noted, I think TableView is broken.  In my testing I would cause array index exceptions which appeared to be related to moving to the top of the table, so similar to yours.  However you may also have found that the processing recoves from this and the user may not notice. 

 

Anyway, am i right in saying you have something that works for you?

 

Please use plain text.
New Contributor
samup4web
Posts: 7
Registered: ‎02-01-2013
My Device: Various

Re: Problem with touch event / focus /navigation Click. TableView with ButtonField on banner

Hi,

Thanks for the link. 

Well, I believe I have a workable solution in general, still with the exception though.  I guess the original setup I had in mind (my first post) is not possible. 

 

Please use plain text.