1. venk's Avatar
    I have a display related question that I have not been able to answer. It is related item (c) below.

    Scenario:
    Lets say I have 5 cards in my hand.
    a. I want to display the cards in a row, one next to the other, BUT, with the cards overlapping partially (just like the way you would hold a few cards in your hand while playing a game).
    b. Once I have displayed the cards, I want to be able to move focus from one card to another as I scroll using the trackball
    c. When any card has focus, I want that card to be layered above all the cards -- in other words, if this card was only partially displayed because it was behind another card, yet, when it gets focus, it should display itself fully above all other cards so that it can be seen completely.

    I have been able to achieve (a) and (b) thanks to the API documentation and thanks to all that I have learned from the responses on crackberry's forums. To achieve (a) and (b), each of my cards is a BitmapField and I have a custom manager to help me display and scroll through cards.

    However, I am JUST NOT able to achieve (c) above. It seems like the Manager (net.rim.device.api.ui.Manager) displays fields in the same order that they were added to it. So if you add field1 to the manager before you add field2, then the Manager always (yes, always) displays field1 below or under field2 in case of partial overlaps between field1 and field2. I found that the only way to get around this problem was to "delete" field1 from the manager and "add" it back to have it display above field2 on the screen. I find this workaround ridiculous since intuitively adding/deleting fields from a manager and fixing display issues of those fields seem unrelated to me. So, can someone help with a better solution?

    Thanks!
    05-05-09 03:12 PM
  2. ydaraishy's Avatar
    You may want to use a custom manager for this, so you have tighter control over how the graphics and the fields are layed out and painted. I can't think of anything specific you could try, sorry.
    05-05-09 06:06 PM
  3. venk's Avatar
    Thanks for responding ydaraishy. I am using a custom manager already. However, there are no methods in the Manager API that allow me to control what field has to appear on top of what other field. This aspect is controlled by the order in which the fields were added to the manager and after the field has been added, there is no way to control the above aspect of "layering".
    05-05-09 08:19 PM
  4. ydaraishy's Avatar
    Think about trying to mark rectangles on screen as dirty and then repainting them in the desired order.

    I'm just pulling this off the top of my head, I'm not sure this is actually doable or not.
    05-05-09 10:10 PM
  5. legallyaddictive's Avatar
    If you override the paint method in your manager and call the paintChild(...) methods manually in the appropriate order you could overlap your cards. You may end up with some issues with repainting not occuring as you would expect so you might need to make sure that your invalidation is happens agains correctly when focus is changed between cards.
    05-13-09 12:55 PM
LINK TO POST COPIED TO CLIPBOARD