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
Highlighted
Contributor
Posts: 20
Registered: ‎04-14-2010
My Device: tour 9650
My Carrier: indosat
Accepted Solution

[ASK] can't scroll screen my application

 I have a code

 public Proses(){            
	    	super();
	    		    	
            setTitle("Choose Language");
            
            LabelField title = new LabelField("SILAHKAN PILIH BAHASA", LabelField.HCENTER| LabelField.HCENTER);
            setTitle(title);


            //TODO ChoiceButton       
            ChoiceB1 = new ObjectChoiceField("From:", objects1,0,0)
    		{
                public int getPreferredHeight() 
                {
                    return 10;
                }
                
                public int getPreferredWidth() 
                {
                    return 240;
                }

                public void layout(int width, int height) 
                {
                    setExtent(getPreferredWidth(), getPreferredHeight());
                    super.layout(getPreferredWidth(), getPreferredHeight());
                }
            };
            ChoiceB2 = new ObjectChoiceField("   To:", objects2,0,0)
    		{
                public int getPreferredHeight() 
                {
                    return 10;
                }
                
                public int getPreferredWidth() 
                {
                    return 240;
                }

                public void layout(int width, int height) 
                {
                    setExtent(getPreferredWidth(), getPreferredHeight());
                    super.layout(getPreferredWidth(), getPreferredHeight());
                }
            };	
            
            HorizontalFieldManager fieldmanager = new HorizontalFieldManager(USE_ALL_WIDTH);
            fieldmanager.add(ChoiceB1);
            fieldmanager.add(ChoiceB2);
            this.add(fieldmanager);
            
  
            add(new SeparatorField()); 
            add(new LabelField("source:\n",0,-1,Field.FIELD_LEFT));
            txtAsal = new EditField("", "",100, 0);
            add(txtAsal);
            
            add(new LabelField("Result:\n",0,-1,Field.FIELD_LEFT));
            txtHasil = new EditField("", "");
            add(txtHasil);

            txtHasil.setBorder(BorderFactory.createBevelBorder(new XYEdges(3, 3, 3, 3)));
            txtHasil.setPadding(8, 8, 8, 8);
            txtHasil.setMargin(15, 15, 15, 15);
            txtAsal.setBorder(BorderFactory.createBevelBorder(new XYEdges(3, 3, 3, 3)));
            txtAsal.setPadding(8, 8, 8, 8);
            txtAsal.setMargin(15, 15, 15, 15);
      
            
            btnTranslate = new ButtonField("Translate", ButtonField.CONSUME_CLICK);
            btnTranslate.setChangeListener(this);
           
            
         
            btnClrH2 = new ButtonField("Clear", ButtonField.CONSUME_CLICK);
            btnClrH2.setChangeListener(this);
 
            
            _btnConvert = new ButtonField ("Sound",ButtonField.CONSUME_CLICK);
			_btnConvert.setChangeListener(this);
			
            HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_LEFT);
       		buttonManager.add(btnTranslate);
       		buttonManager.add(btnClrH2);
       		buttonManager.add(_btnConvert);
            add(buttonManager);

 

first picture

 

 

problem on my app..

i cant scroll Smiley Sad

 

 

 

 

anyone please help me.. Smiley Sad

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: [ASK] can't scroll screen my application

Add like this in vertical manager:

 

VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
    	vfm.add(new LabelField("source:\n",0,-1,Field.FIELD_LEFT));
         txtAsal = new EditField("", "",100, 0);
         vfm.add(txtAsal);
         
         vfm.add(new LabelField("Result:\n",0,-1,Field.FIELD_LEFT));
         txtHasil = new EditField("", "");
         vfm.add(txtHasil);
         add(vfm);

 you can also add buttonManager accordingly in this vertical manager

 

Hit Like if you found your solution, Good Luck

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: [ASK] can't scroll screen my application

use like this

super(NO_VERTICAL_SCROLL);
    	
        setTitle("Choose Language");
        
        LabelField title = new LabelField("SILAHKAN PILIH BAHASA", LabelField.HCENTER| LabelField.HCENTER);
        setTitle(title);


        //TODO ChoiceButton       
        ChoiceB1 = new ObjectChoiceField("From:", objects1,0,0)
		{
            public int getPreferredHeight() 
            {
                return 10;
            }
            
            public int getPreferredWidth() 
            {
                return 240;
            }

            public void layout(int width, int height) 
            {
                setExtent(getPreferredWidth(), getPreferredHeight());
                super.layout(getPreferredWidth(), getPreferredHeight());
            }
        };
        ChoiceB2 = new ObjectChoiceField("   To:", objects2,0,0)
		{
            public int getPreferredHeight() 
            {
                return 10;
            }
            
            public int getPreferredWidth() 
            {
                return 240;
            }

            public void layout(int width, int height) 
            {
                setExtent(getPreferredWidth(), getPreferredHeight());
                super.layout(getPreferredWidth(), getPreferredHeight());
            }
        };	
        
        HorizontalFieldManager fieldmanager = new HorizontalFieldManager(USE_ALL_WIDTH);
        fieldmanager.add(ChoiceB1);
        fieldmanager.add(ChoiceB2);
        this.add(fieldmanager);
        

        add(new SeparatorField()); 
        VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
        vfm.add(new LabelField("source:\n",0,-1,Field.FIELD_LEFT));
        txtAsal = new EditField("", "",100, 0);
        vfm.add(txtAsal);
        
        vfm.add(new LabelField("Result:\n",0,-1,Field.FIELD_LEFT));
        txtHasil = new EditField("", "");
        vfm.add(txtHasil);
        

        txtHasil.setBorder(BorderFactory.createBevelBorder(new XYEdges(3, 3, 3, 3)));
        txtHasil.setPadding(8, 8, 8, 8);
        txtHasil.setMargin(15, 15, 15, 15);
        txtAsal.setBorder(BorderFactory.createBevelBorder(new XYEdges(3, 3, 3, 3)));
        txtAsal.setPadding(8, 8, 8, 8);
        txtAsal.setMargin(15, 15, 15, 15);
  
        
        btnTranslate = new ButtonField("Translate", ButtonField.CONSUME_CLICK);
        btnTranslate.setChangeListener(this);
       
        
     
        btnClrH2 = new ButtonField("Clear", ButtonField.CONSUME_CLICK);
        btnClrH2.setChangeListener(this);

        
        _btnConvert = new ButtonField ("Sound",ButtonField.CONSUME_CLICK);
		_btnConvert.setChangeListener(this);
		
        HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_LEFT);
   		buttonManager.add(btnTranslate);
   		buttonManager.add(btnClrH2);
   		buttonManager.add(_btnConvert);
        vfm.add(buttonManager);
        add(vfm);

 Hit Like if you found your solution

Contributor
Posts: 20
Registered: ‎04-14-2010
My Device: tour 9650
My Carrier: indosat

Re: [ASK] can't scroll screen my application

COOLLLL... THANKS YOU