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
Regular Contributor
Q3test
Posts: 77
Registered: ‎06-13-2013
My Device: 9900
My Carrier: blackberry cure

Why drop downis not display in blackberry?

 


 

I am adding drop down in my screen, But It is not display .Actually my background is black .I think due to black background it in not display but when focus is come it show all option I use code from Here can I change my drop down colour ?

http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_drop-down_list_509565_11.jsp

Please use plain text.
Developer
simon_hain
Posts: 15,870
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Why drop downis not display in blackberry?

please post your code.
a dropdown should be visible on a black background.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Regular Contributor
Q3test
Posts: 77
Registered: ‎06-13-2013
My Device: 9900
My Carrier: blackberry cure

why the label of ObjectChoiceField hide when background is black in blackberry

I am using ObjectChoiceField actually My label is hide when I use black background ?I am using this example

http://docs.blackberry.com/en/developers/deliverables/18125/Drop_down_menus_1177778_11.jsp

My text is "Day of week " is hide due to black background ? How to give some margin to given label *"Day of week "

 

 

package mypackage;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.ObjectChoiceField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

/**
 * A class extending the MainScreen class, which provides default standard
 * behavior for BlackBerry GUI applications.
 */
public final class MyScreen extends MainScreen
{
    /**
     * Creates a new MyScreen object
     */
    public MyScreen()
    {        
        // Set the displayed title of the screen       
    	setTitle("Drop-down List Demo"); 
        String choices[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
        int iSetTo = 0;
        VerticalFieldManager vfm=new VerticalFieldManager(){
        	protected void paint(Graphics graphics) {
        		// TODO Auto-generated method stub
        		graphics.setBackgroundColor(Color.BLACK);
        		graphics.fillRect(0, 0, Display.getWidth(), 800);
        		super.paint(graphics);
        	}
        };
        vfm.add(new ObjectChoiceField("Day of the week",choices,iSetTo){
        	protected void paint(Graphics graphics) {
        		// TODO Auto-generated method stub
        		graphics.setBackgroundColor(Color.WHITE);

        		super.paint(graphics);
        	}
        });

        
        
        add(vfm);
        
    }
}

 

 

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: why the label of ObjectChoiceField hide when background is black in blackberry

Try the following, and review the API so you know when to set the Background color and when to set the Foreground color.

 

        String choices[] = {"Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday", "Sunday"};
        int iSetTo = 0;
        VerticalFieldManager vfm=new VerticalFieldManager(){
        	protected void paint(Graphics graphics) {
        		graphics.setBackgroundColor(Color.BLACK);
        		graphics.clear();
        		super.paint(graphics);
        	}
        };
        vfm.add(new ObjectChoiceField("Day of the week",choices,iSetTo){
        	protected void paint(Graphics graphics) {
        		graphics.setColor(Color.WHITE);
        		super.paint(graphics);
        	}
        });

 

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: why the label of ObjectChoiceField hide when background is black in blackberry

Since you use the above code in your other Thread:

 

http://supportforums.blackberry.com/t5/Java-Development/How-to-move-drop-left-in-blackberry-java/m-p...

 

I assume that it has provided the solution to your problem.  If so, it is usual and good practice to mark the Thread as solved.  Instructions for doing this can be found using the Help link near the top of the screen. 

Please use plain text.