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
New Contributor
Martijnxb
Posts: 3
Registered: ‎08-08-2010
My Device: Bold 9700
Accepted Solution

GridFieldManager with label getting wider

I've searched the forums, but could not find the answer to my problem. so, who can help me out here.

 

I've got a GridFieldManager, with 2 labels containing static text, and two labels with text that I want to change during runtime.

 

GridFieldManager gfm = new GridFieldManager(2, 2, Manager.USE_ALL_WIDTH | GridFieldManager.FIXED_SIZE);
gfm.setColumnProperty(0, GridFieldManager.FIXED_SIZE, 300);
gfm.setColumnProperty(1, GridFieldManager.FIXED_SIZE, 180);
float TMeasured = 180 / 10;
float TSetpoint = 195 / 10;
lTemperatureMeasured = new LabelField(Float.toString(TMeasured) + "°c");
lTemperatureSetpoint = new LabelField(Float.toString(TSetpoint) + "°c");
gfm.add(new LabelField("Temperature measured"), FIELD_LEFT);
gfm.add(lTemperatureMeasured, FIELD_LEFT);//RIGHT);
gfm.add(new LabelField("Temperature setting"), FIELD_LEFT);
gfm.add(lTemperatureSetpoint, FIELD_LEFT);//RIGHT);
add(gfm);

 

 

the problem is, that when I change the text of a label, the GridFieldManager gets wider! it just grows and grows by something like 5 pixels. changing the fixed widths did not help.

I just can't figure out why this happens. who does?

 

Changing the text is done with a button:

 

 

public void fieldChanged(Field field, int context)
{      
    if(field == bChangeTemperature)
    {
         lTemperatureSetpoint.setText("t");
    }
}

 

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: GridFieldManager with label getting wider

This issue has been logged in Issue Tracker here:  https://www.blackberry.com/jira/browse/JAVAAPI-1341

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Contributor
kehn
Posts: 2
Registered: ‎03-06-2009
My Device: Not Specified

Re: GridFieldManager with label getting wider

Just a note to say I found a solution/workaround for the GridFieldManager's growing field issue that at least worked for me.

 

After changes to the grid I call:

 

        grid.setCellPadding(0);
        grid.setColumnPadding(0);

 

Maybe the padding values get changed incorrectly (and keep growing) and need to be reset???

 

 

Please use plain text.