[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kvm-interest
Subject:    MIDP 2.0 layout question
From:       Eric Obermuhlner <eobermuhlner () ESMERTEC ! COM>
Date:       2003-07-21 9:53:56
[Download RAW message or body]

I have a question concerning the layout of Items in a Form in MIDP 2.0.

If I understand the specification correctly every Item is put at
LEFT/CENTER/RIGHT according to it's alignment value (with setLayout()).
If an Item has no alignment value specified it uses the one from the
previous Item (the spec calls this the 'current alignment').
At the end of this email I added a copy of the relevant paragraph.

The WTK 2.0 behaves different.
If you say something like:
{
        Form form = new Form("Test");
        form.append("String before");
        ImageItem imgitem = new ImgItem("My Image", myimg);
        imgitem.setLayout(
          Item.LAYOUT_CENTER|
          Item.LAYOUT_NEWLINE_BEFORE|
          Item.LAYOUT_NEWLINE_AFTER|
          Item.LAYOUT_2);
        form.append(imgitem);
        form.append("String after");
}

I would expect it to look like this:
+-------------------------------------------+
|String before                              |
|              My Image @@@                 |
|                       @@@                 |
|               String after                |
+-------------------------------------------+
but in the WTK 2.0 it looks like this:
+-------------------------------------------+
|String before                              |
|              My Image @@@                 |
|                       @@@                 |
|String after                               |
+-------------------------------------------+

Did I interpret the specification wrong?

Thanks,
Eric





### BEGIN copy of MIDP 2.0 API spec (from 'Form)
The layout algorithm has a concept of a current alignment. It can have
the value LAYOUT_LEFT, LAYOUT_CENTER, or LAYOUT_RIGHT. The value of the
current alignment at the start of the layout algorithm depends upon the
layout direction in effect for this Form. If the layout direction is
left-to-right, the initial alignment value must be LAYOUT_LEFT. If the
layout direction is right-to-left, the initial alignment value must be
LAYOUT_RIGHT. The current alignment changes when the layout algorithm
encounters an Item that has one of the layout directives LAYOUT_LEFT,
LAYOUT_CENTER, or LAYOUT_RIGHT. If none of these directives is present
on an Item, the current layout directive does not change. This rule has
the effect of grouping the contents of the Form into sequences of
consecutive Items  sharing an alignment value. The alignment value of
each Item  is maintained internally to the Form and does not affect the
Items' layout value as reported by the Item.getLayout method.
### END copy of MIDP 2.0 API spec

 ==========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic