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: 54
Registered: ‎01-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

Still trying to get my head wrapped around the manger part  of this.  If i remove the super line for verticalmanager and instead create a new verticalmanager and put the paint override inside the verticalmanager, I get an error

 

 

public class NGCustomPopupScreen extends PopupScreen implements
   KeyListener {
   private String _response;
   public NGCustomPopupScreen()
   {
       super(new VerticalFieldManager(),Field.FOCUSABLE);

        AnimatedGIFField testanimated= new AnimatedGIFField((GIFEncodedImage)(GIFEncodedImage.getEncodedImageResource( "res/wait30trans.gif" )),AnimatedGIFField.FIELD_LEFT); 
        add(testanimated);
        
   }

   protected void applyTheme() {

   }
   //protected void paintBackground(Graphics graphics) {
   //     graphics.setBackgroundColor(16777215); // 16777215 is transparent code.
   //}
    protected void paint(Graphics graphics)
    {
     int alpha = graphics.getGlobalAlpha();
     graphics.setGlobalAlpha(100);
     graphics.setBackgroundColor(16777215);           
     graphics.clear();                  
     super.paint(graphics);
     graphics.setGlobalAlpha(alpha);

    }

 

 

The error is:

cannot find symbol
symbol  : constructor PopupScreen()
location: class net.rim.device.api.ui.container.PopupScreen
   {

 

 

Here are my improper imports, but I'm just testing.:

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

 

 

Do you see what I'm doing wrong here?

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: PopupScreen with transparent background and theme for Storm

popupscreen needs a manager in its constructor. check the api.

----------------------------------------------------------
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 Developer
Posts: 54
Registered: ‎01-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

I pretty much live in the API these days and the code I provided above works perfectly.  The problem is that the line:

super(new VerticalFieldManager(),Field.FOCUSABLE);

 

does not override the paint method which I want to do for this verticalfieldmanager.

 

As soon as I comment the super line above and try something like:

 

        VerticalFieldManager vfm = new VerticalFieldManager(Field.FOCUSABLE) {

        };

 

I get the error

 

symbol  : constructor PopupScreen()
location: class net.rim.device.api.ui.container.PopupScreen
   {

 

 

Unless I also can't read, the API does not tell me why or at least not directly enough for my inexperience with Java to undersand.

 

I understand what you are saying in that popupscreen needs a manager as the API suggests, but I don't undestand what is different between the super and the vfm VerticalFieldManager I'm listing in this post and why the latter generates the error.

 

Ultimately, I just want to change that super line so that I can override the paint method for the VerticalFieldManager.

Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

I'm following this thread closely, as I have the same problem.

 

I guessing that the theme instructs the screen to have a transparent background and

for all the child managers to do the same. Is this correct? That would make it necessary

to override paint and change alphas for all managers as well. Is that true?

 

OP: How about an (non-anon) inner class for manager to pass into PopupScreen.

 

Ty

New Developer
Posts: 54
Registered: ‎01-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

[ Edited ]

tkroll, I'm not sure about applyTheme.  I actually haven't found documentation in the API for this specific method so I'm a little lost.  Was over my head to begin with so I'm not sure how to describe where I am now. -=O)

 

Something I noticed on another forum that I'm not sure applies here was that someone say they changed their main class to Application not only UiApplication.

 

Maybe overriding the seemingly undocumented applyTheme() is the correct approach.  Sure would be nice if I could find another way though. 

 

Another thread I've found where the OP has some level of transparency working with a PopupScreen is here.  Though I've been trying some of what is found there and haven't yet found the answer.

http://rim.lithium.com/t5/Java-Development/Problem-in-semiTransparent-popup-screen/m-p/61626

 

Big thing at the moment is that I don't know how to override that super verticalfieldmanager because as soon as I change that line, it won't compile.  Gives the error listed in last post.  Seems like that verticalfieldmanager needs to have the paint or paintBackground override but I'm not sure how to achieve this yet.

 

Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

Just make a inner class inside your main class

 

public NewVfm extends VerticalFieldManager {

   NewVfm(int style) {

      super(style);

   }

 

   protected void paint(Graphics g) {

      // blah blah blah

   }

}

 

Then use new NewVfm(USE_ALL_WIDTH, USE_ALL_HEIGHT) in super for PopupScreen.

 

 

New Developer
Posts: 54
Registered: ‎01-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

Thanks!

 

Getting error on just one part of this.  Got an idea?

 

cannot reference this before supertype constructor has been called

 

super(new NewVfm(USE_ALL_WIDTH, USE_ALL_HEIGHT));

 

Here is code up to this line:

 

public class NGCustomPopupScreen extends PopupScreen implements
   KeyListener {
   
      public class NewVfm extends VerticalFieldManager {

   NewVfm(int style) {

      super(style);
   }

   protected void paintBackground(Graphics g) {

      g.setBackgroundColor(16777215);

   }
}
   
   
   public NGCustomPopupScreen()
   {

super(new NewVfm(USE_ALL_WIDTH, USE_ALL_HEIGHT));

 

 

Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

USE_ALL_WIDTH, USE_ALL_HEIGHT should be USE_ALL_WIDTH | USE_ALL_HEIGHT.

 

If it still complains put NewVfm into another file.

New Developer
Posts: 54
Registered: ‎01-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

I put it in a new file.  Runs but doesn't seem to change anything.  I've tried paint and paintBackground methods in the NewVfm class.  Hmm.

 

Maybe it isn't the VerticalFieldManager causing the issue after all.

Developer
Posts: 81
Registered: ‎06-24-2009
My Device: Not Specified

Re: PopupScreen with transparent background and theme for Storm

Let's wait for the gurus to chime in. HELP!

 

I know this can be done.