BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-06-2007, 01:33 PM   #1
koedur
Knows Where the Search Button Is
 
Join Date: May 2007
Model: 8800
PIN: N/A
Carrier: Rogers
Posts: 17
Default ListField, Variable Row Height, and OS 4.1

Please Login to Remove!

I'm trying to display a list of Bitmaps. The bitmaps are all different sizes.

When I use the following code in a Blackberry that runs OS 4.2, everything is fine. As soon as I use the following code for OS 4.1 (say an 8700), things are all screwed up.

Anybody have any thoughts?

Code:
/*
 * Displays a list of bitmap images
 * Copyright (C) 2007  Albert Huh
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ObjectListField;

public class BitmapList extends ObjectListField {

    private static int TOP_BUFFER = 2;
    private static int BOTTOM_BUFFER = 2;

    public void drawListRow( ListField lf, Graphics g, int i, int y, int w ) {
        Bitmap b = (Bitmap) get( lf, i );

        // rowheight is heigh of the image plus a buffer at top and bottom
        int rowHeight = b.getHeight() + TOP_BUFFER + BOTTOM_BUFFER;
        setRowHeight( i, rowHeight );

        // draw the image a bit off top of the row
        g.drawBitmap( 0, y + TOP_BUFFER, b.getWidth(), b.getHeight(), b, 0, 0 );

        //draw seperator line
        g.setColor( Color.DARKGRAY );

        // draw line across bottom of the row
        g.drawLine( 0, y + rowHeight - 1, w, y + rowHeight - 1 );
    }

}
Offline  
Old 07-06-2007, 03:28 PM   #2
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

all screwed up like they're wrongly sized or you get compiler or runtime exceptions
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Siemens 6ES7214-1HG40-0XB0 Compact Processor picture

Siemens 6ES7214-1HG40-0XB0 Compact Processor

$225.00



NEW SEALED AB 1747-L541 /C SLC 500 SLC 5/04 CPU PROCESSOR UNIT MODULE US picture

NEW SEALED AB 1747-L541 /C SLC 500 SLC 5/04 CPU PROCESSOR UNIT MODULE US

$310.93



AB 1747-L542 /B SLC 500 5/04 CPU PROCESSOR UNIT New Factory Sealed AB 1747L542 picture

AB 1747-L542 /B SLC 500 5/04 CPU PROCESSOR UNIT New Factory Sealed AB 1747L542

$334.57



Omron CJ2H-CPU66-EIP Processor/Controller picture

Omron CJ2H-CPU66-EIP Processor/Controller

$490.00



1000W Stainless Steel Welding Bead Processor,Brush Type Weld Cleaning Machine picture

1000W Stainless Steel Welding Bead Processor,Brush Type Weld Cleaning Machine

$204.00



Brocade 105-000-138 CP8 XBR-DCX-0103 Control Processor card DCX 4 / 8 Chas picture

Brocade 105-000-138 CP8 XBR-DCX-0103 Control Processor card DCX 4 / 8 Chas

$74.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.