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
feng131719
Posts: 4
Registered: ‎04-05-2010
My Device: 8300
Accepted Solution

"Not - full screen" application possible ?

Hi.

I am trying to create an App that will not span over full display.
Is there a way to do this in BB?

 



package Test;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.Display;
import net.rim.device.api.system.Application;

/**
 * name:灰太狼大王
 */
public final class Test extends UiApplication{
   
    Test(){
           Ui.getUiEngine().pushGlobalScreen(new HelloScreen(), 1, UiEngine.GLOBAL_QUEUE);  
    }
    public static void main(String [] arg){
        Test app=new Test();
        app.enterEventDispatcher();
    }
    private  final class HelloScreen extends PopupScreen{
         private final int screenW=Display.getWidth();
         private final int screenH=Display.getHeight();
         private final int _W=screenW*8/10;
         private final int _H=(Font.getDefault().getHeight()<<1)+30;
         private final int _X=(screenW-_W)>>1;
         private final int _Y=(screenH-_H)>>1;
         private final String tipzh1="11111";
        public HelloScreen(){   
            super( new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR ));
        }
        
        public boolean keyDown(int keycode, int time){
            System.out.println("keyDown keyCody="+keycode);
            char key=Keypad.map(keycode);
            if(key=='a'){
                close();
            }
           return true;
          // return super.keyDown( keycode, time );
        }
        public  boolean  keyRepeat(int keycode, int time){
              System.out.println("keyRepeat keyCody="+keycode);
             return true;
          // return super.keyRepeat( keycode, time );
        }
        public  boolean keyChar(char c, int status, int time){
             System.out.println("keyChar char="+c +" status="+status);
             return true;
            // return super.keyChar(c,status,time);
        }
       protected void paint(Graphics graphics){
          //  super.paint(graphics);
            System.out.println("paint");
            

            graphics.drawText(tipzh1,2,10);
            graphics.drawText(tipzh2,2,20+Font.getDefault().getHeight());
          // super.paint( graphics);

        }
        protected  void paintBackground(Graphics g){
            XYRect myExtent = getExtent();
            int color = g.getColor();
             g.setBackgroundColor(0xE1E1E1);
             g.clear();
             g.setColor(0x999999);
             g.drawRect(0,0,myExtent.width,myExtent.height);
             g.setColor(color);
        }
       public void sublayout( int width, int height ){
           System.out.println("sublayout");
           setPositionDelegate(_X, _Y);
           setExtent(_W,_H);
           setPosition(_X, _Y);
           layoutDelegate(_W,_H);
       }    
    }
}

 

2642i3526823070216AF2

 

 

I am doing this but the whole screen gets painted white (except, of course, the popup window)

any idea ?

New Contributor
feng131719
Posts: 4
Registered: ‎04-05-2010
My Device: 8300

Re: "Not - full screen" application possible ?

Do you understand me?

I am  not strong in English.

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: "Not - full screen" application possible ?

screens in uiapplications always have white backgrounds.

 

your only option would be to use global popupscreens which can be of a limited size (but have lots of other limitations)

----------------------------------------------------------
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
New Contributor
feng131719
Posts: 4
Registered: ‎04-05-2010
My Device: 8300

Re: "Not - full screen" application possible ?

Can you give me more detail, then?

an example ?

Thank you!

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: "Not - full screen" application possible ?

Just to repeat Simon's points, If an Application is in the foreground, the Blackberry expects it to use the whole screen.

 

If you want to pretend it is not using the whole screen, then take a screen shot when your app starts, and use that as the background. 

 

Restrictions on Global Screens include

a) not supporting Fields that have popups, like the Date/Time

b) Not supporting Menus

c) Hiding other global Popup Screens, that might be telling the user something important.

 

I would not consider writing an application based on using these.