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
Trusted Contributor
swapnil_gadkari
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

custom dialog issue..

hi all,

       i just can't understand on how to proceed on this issue.

 i want to create the custom dialog / popscreen, which will have custom bimap as background and will also have a custom bitmapbutton field on it. which would just display  "ok". how can i do it?

 

should i extend my custompopscreen class with Popupscreen class provided by rim?

if yes then what should i put inside this constructor

PopupScreen(Manager delegate, long style);

 

for the Manager delegate value i mean??

 

Swapnil G.
Developer
anilsisodiya
Posts: 193
Registered: ‎04-27-2009
My Device: Not Specified

Re: custom dialog issue..

you can either extend dialog class or popscreen class . you can create background using your bitmap and then can set this background in Custompopupscreen /CustomDialog class.

Regarding popupscreen constructor you have to do something like as follow:-

super(new VerticalFieldManager(USE_ALL_WIDTH | USE_ALL_HEIGHT), Field.FOCUSABLE);

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

Re: custom dialog issue..

view the manager as the screen that should be displayed. create it was you want it (background, button etc) and call the popupscreen constructor with it.
----------------------------------------------------------
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
Trusted Contributor
swapnil_gadkari
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

Re: custom dialog issue..

[ Edited ]
public class CustomPops extends PopupScreen
{
	private Bitmap _popupbitmap;

	public CustomPops(Bitmap _bitmap)
	{
		super(new VerticalFieldManager(USE_ALL_WIDTH));
		this._popupbitmap = _bitmap;
	}
	
	protected void paint(Graphics graphics)
	{
		graphics.drawBitmap(0, 0,_popupbitmap.getWidth(),_popupbitmap.getHeight(), _popupbitmap, 0, 0);
		setExtent(200, 100);
		super.paint(graphics);
	}
	
	protected void sublayout(int width, int height)
	{	
		setExtent(Display.getWidth(),Display.getHeight());
	}
}

 

this is my code i'm calling it on the button click as

UiApplication.getUiApplication().pushScreen(new CustomPops(_bitmap));

 still it is showing me as IllegalState Exception and also it is not showing as the alert box

Swapnil G.
Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: custom dialog issue..

This is a different problem to the one that started the Thread isn't it?  Probably should go in a different Thread.

 

Debug this and look at the detail message that comes with the IllegalStateException.  It will give you more of a clue as to what your code has done wrong.

 

It is often useful to track this exception (again using the debugger) back to the statement in your code that causes it. 

 

However in this case, it seems from your code that you do not understand how to use paint and managers.  You should not call setExtent in the middle of paint.  I suggest that you review the two videos that describe extending the screen and extending the manager, and also review the KB article about creating your own custom manager.

 

You also want to use a Bitmap as a background.  Do a general search on this forum about this, there are many other people asking how to do this.  In this case as Simon suggested, I suspect the best option is to have the Bitmap as the background to the Manager you use when you create the Popup screen.