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 Developer
Posts: 23
Registered: ‎10-20-2008
My Device: Not Specified
Accepted Solution

White Screen when Using ObjectChoiceField

I am using the 4.5.0.7 JDE and the Simulator for the 8300 device.  I define an ObjectChoiceField as shown below

 

String choices[] = {"Dr. Harper", "Dr. Jackson" , "Dr. Peterson" ,"Patty" }; 
        _sendTo = new ObjectChoiceField("Send To : " ,choices,0, Field.FOCUSABLE | EditField.FIELD_LEFT);
        add(_sendTo);

The screen this is on displays fine.  However, when I try to make a selection on the screen using the space bar in the simulator as I have on other screens for ObjectChoiceFields I get a warning in the JDE that states "WARNING: Cannot layout field, insufficient height"

 

Any ideas on what my problem might be?

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: White Screen when Using ObjectChoiceField

You forgot to initialize your array.

 

Should be 

 

 

String choices[] = new String[]{"Dr. Harper", "Dr. Jackson" , "Dr. Peterson" ,"Patty" };

 

 

 

New Developer
Posts: 23
Registered: ‎10-20-2008
My Device: Not Specified

Re: White Screen when Using ObjectChoiceField

No that wasn't it.  I tried it just to be sure but it gave the same results.  I have another one just like it on another screen (see below)

 

   String choices[] = {"Rounding", "Patient" , "Appointment" ,"Encounter" , "Configuration" };
        _initialScreen = new ObjectChoiceField("Choose Screen: " ,choices,0, Field.FOCUSABLE | EditField.FIELD_HCENTER);
        add(_initialScreen);

This one works fine on the other screen and appears to be the same (other than the choices themselves) as the one that isn't working on ny new screen.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: White Screen when Using ObjectChoiceField

What JDE version are you using ?
New Developer
Posts: 23
Registered: ‎10-20-2008
My Device: Not Specified

Re: White Screen when Using ObjectChoiceField

I am using the 4.5.0.7 JDE and the Simulator for the 8300 device.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: White Screen when Using ObjectChoiceField

[ Edited ]

The following code works on my JDE 4.5 (BB 8300 Simulator OS version 4.5.0.44)

 

It also works in JDE 4.0.2, JDE 4.3.0, JDE 4.6.1

 

package com.polygon.app;

import com.polygon.app.view.MyScreen;
import net.rim.device.api.ui.UiApplication;

public class Application extends UiApplication{

public static void main(String[] args) {
(new Application()).enterEventDispatcher();
}

public Application() {
this.pushScreen(new MyScreen());
}
}

 

 

package com.polygon.app.view;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.container.MainScreen;;
import net.rim.device.api.ui.component.ObjectChoiceField;
import net.rim.device.api.ui.component.EditField;


public class MyScreen extends MainScreen {

public MyScreen() {
super();
addScreenItems();
}

public void addScreenItems() {
String[] choices = new String[]{"Rounding", "Patient" , "Appointment" ,"Encounter" , "Configuration"};
ObjectChoiceField _initialScreen = new ObjectChoiceField("Choose Screen: " ,choices,0, Field.FOCUSABLE | EditField.FIELD_HCENTER);
add(_initialScreen);
}
}

 

 
Message Edited by tbilisoft on 05-01-2009 10:53 PM
New Developer
Posts: 23
Registered: ‎10-20-2008
My Device: Not Specified

Re: White Screen when Using ObjectChoiceField

I am using it on a FullScreen and not the MainScreen but it should work the same way shouldn't it?

 

Can you try it with the first example I gave you?  It is the one that is failing.

 

Thanks

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: White Screen when Using ObjectChoiceField

I changed the second class in the following way:

 

 

package com.polygon.app.view; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.container.MainScreen;; import net.rim.device.api.ui.component.ObjectChoiceField; import net.rim.device.api.ui.component.EditField; import net.rim.device.api.ui.container.FullScreen; public class MyScreen extends FullScreen { public MyScreen() { super(); addScreenItems(); } public void addScreenItems() { String[] choices = new String[]{"Rounding", "Patient" , "Appointment" ,"Encounter" , "Configuration"}; ObjectChoiceField _initialScreen = new ObjectChoiceField("Choose Screen: " ,choices,0, Field.FOCUSABLE | EditField.FIELD_HCENTER); add(_initialScreen); } }

 

 and it works in JDE 4.5.0 and BB 8300 simulator.

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: White Screen when Using ObjectChoiceField

Does this sample code work for you ?
New Developer
Posts: 23
Registered: ‎10-20-2008
My Device: Not Specified

Re: White Screen when Using ObjectChoiceField

No, if I put your code in my screen it fails.  There must be something wrong with my screen, but I am not sure what it would be.