Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry -- Updating screen changes drawing order of manager its field elements
    primarykey
    data
    text
    <p><strong>Scenario</strong><br> In a screen I have 2 managers: 1) menu manager at the top and 2) body manager that has info/button elements. The menu manager does custom drawing so that its menu elements (LabelFields) are properly spaced.</p> <p><strong>Core Issue - Manager and subfield drawing order</strong><br> The screen draws fine except when the user preforms an action (clicks a button) that results in an element withing the body manager being added/removed. Once field elements are added/removed from the body, the order in which the menu is drawn gets mixed up. </p> <p>When the body manager adds or removes a field, <strong><em>instead of the menu manager drawing itself and then its sub elements (label fields), the menu manager begins to draw its sub elements and then itself</em></strong>; thus painting on top of the label fields and making them look like they've disappeared.</p> <p><strong>Comments</strong><br> Already tried invalidate and other options -- I've tried to call invalidate, invalidateall, updateDisplay... after adding/removing field elements from body. All without success.</p> <p>Removing custom sublayout works -- The only way that I can resolve this issue is to remove the menu managers custom sublayout logic. Unfortunately the menu system then draws in a traditional manner and does not provide enough spacing. </p> <p>Below is the sublayout code for the menu manager, am I missing something here?</p> <pre><code>public void sublayout(int iWidth, int iHeight) { final int iNumFields = getFieldCount(); int maxHeight = 0; final int segmentWidth = iWidth / iNumFields; final int segmentWidthHalf = segmentWidth / 2; for (int i = 0; i &lt; iNumFields; i++) { final Item currentField = (Item)this.getField(i); // 1. Use index to compute bounds of the field final int xSegmentTrueCenter = segmentWidth * i + segmentWidthHalf; // 2. center field inbetween bounds using field width (find fill width of text) final int xFieldStart = xSegmentTrueCenter - currentField.getFont().getAdvance(currentField.getText())/2; // set up position setPositionChild(currentField, xFieldStart, getContentTop() + MenuAbstract.PADDING_VERTICAL); // allow child to draw itself layoutChild(currentField, iWidth, currentField.getHeight()); // compute max height of the field //int fieldheight = currentField.getHeight(); maxHeight = currentField.getHeight() &gt; maxHeight ? currentField.getHeight() + 2 * MenuAbstract.PADDING_VERTICAL : maxHeight; } this.setExtent(iWidth, maxHeight); } </code></pre> <p><strong>Final Questions</strong><br> Ultimately I want to keep the custom layout of the menu manager while being allowed to redraw field elements. Here are my final questions:</p> <ol> <li><p>Have you experienced this before?</p></li> <li><p>Why would the menu manager begin drawing in the wrong order when a field element is added/remove to the screen?</p></li> <li><p>Does the native Manager.sublayout() do something that I'm not to maintain drawing order?</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload