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: 47
Registered: ‎03-17-2009
My Device: Not Specified

Making a row of VerticalFieldManager clickable?

Hey folks,

 

I have a custom VFM, im trying to make the fields clickable but no clue.  I even tried adding nullfields and added them to each row, and tried clicking the row - this worked BUT I don't understand how to get the row data being sent.

 

E.g. I have a row which contains a labelfield -> i want this row to be selected and the labelfield being pushed to a new screen. This is what i tried:

 

In my screen class:

 

public void fieldChanged(Field field, int context) { if (field instanceof CustomLabelField) { if (null == articleScreen) { articleScreen = new ArticleScreen(((CustomLabelField)field).getText()); } UiApplication.getUiApplication().pushScreen(articleScreen); //Dialog.alert("Button clicked: " + ((CustomLabelField)field).getText()); } }

 

 

And in my custom label field class:

 

protected void drawFocus(Graphics graphics, boolean on) { // Don't draw the default focus } protected void onFocus(int direction) { super.onFocus(direction); invalidate(); } protected void onUnfocus() { super.onUnfocus(); invalidate(); } public boolean isFocusable() { return true; } protected boolean navigationClick(int status, int time) { fieldChangeNotify(0); return true; } protected boolean keyChar(char character, int status, int time) { if (character == Keypad.KEY_ENTER) { fieldChangeNotify(0); return true; } return super.keyChar(character, status, time); }

 

 

Im not getting the proper label for that row.  What's happening instead is that when i FIRST click a row, i get that rows proper label field.  But when i go back a screen and click any other row, i'll always get the label field for that first row i originally clicked.

 

Hopefully this makes sense,

 

Thanks in advance for your help

Andrew

 

BTW i did look at other posts, e.g. http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=26861&query.id=66... but i didnt get that far with it.

Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Making a row of VerticalFieldManager clickable?

manager is not designed to handle clicks. you can change the implementation by adding at least one click-able field (that does not consume the click) and overwriting navigationClick in the manager.
you could also use (object)listfield if you want to have clickable horizontal rows without extra hassle.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 47
Registered: ‎03-17-2009
My Device: Not Specified

Re: Making a row of VerticalFieldManager clickable?

I tried that -> the problem was that i made the object listfield height size a certain height, and it worked - it took me to a new screen.  But when i went back a screen that height size changed to something smaller!

 

Also when i used the method setRowHeight, it took up an (extra) large amount of memory in the simulator - so i was afraid to use it on the device.

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Making a row of VerticalFieldManager clickable?

Just dropped in on this Thread, so haven't reviewed it sorry, but noted this:

 

"when i used the method setRowHeight, it took up an (extra) large amount of memory in the simulator "

 

setRowHeight should have no impact on the memory used.  If you saw an increase in the memory used I am confident it was something else.