BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 04-29-2008, 03:42 AM   #1 (permalink)
Knows Where the Search Button Is
Join Date: Mar 2008
Model: 8100
Carrier: Airtel
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get Dialog and popScreen getwidth()

Please Login to Remove!

i have creted Dialog screen by overriding Dialog() but i m unable to get the width() of Dialog by using the dialog.getWidth() method can any one know how to get the width of the Dialog
here is my sample method that i have used.

================================================== ===========
dialog_Login = new Dialog("", null, new int[]{0}, 0, null, Field.FOCUSABLE | Field.FIELD_BOTTOM)
protected void paint(Graphics g)
System.out.println("width"+dialog_Login.getVisible Width());
//g.drawImage(new BitmapField(ResManager.getImg(ResManager.IMAGE_HEA DER),
g.drawBitmap(0,0,Constants.SCREEN_WIDTH,25,Bitmap. getBitmapResource("res/header.png"),0,0);
g.setFont(IFont.getFont(IFont.SYSTEM_FONT_PLAIN_14 ));
g.drawText(ResManager.getText(ResManager.TEXT_LOGI N),dialog_Login.getWidth()-IFont.getFont(IFont.SYSTEM_FONT_PLAIN_14).getAdvan ce("Login")*2-10,5);
protected boolean keyChar(char key, int status, int time)

boolean retval = false;
switch (key)
case Characters.ESCAPE:
retval = true;
return retval;


DialogFieldManager dfm=new DialogFieldManager();
UserName_ = new TextField(ResManager.getText(ResManager.TEXT_USER_ NAME),"",20,Color.WHITE,BasicEditField.FOCUSABLE, 4, Constants.SCREEN_WIDTH-10);

Password_ = new PasswordField(ResManager.getText(ResManager.TEXT_P ASSWORD),"",16,Color.WHITE,PasswordEditField.FOCUS ABLE, 4, Constants.SCREEN_WIDTH-10);

System.out.println("Width "+dialog_Login.getWidth());

Old 04-29-2008, 11:31 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
richard.puckett's Avatar
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts

Field widths aren't typically calculated until the Field's "layout" method is called, and that's not happening until you call show(). Perhaps you could try querying for the width right after calling "show".
Do your homework and know how to ask a good question.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Siemens Varistor 3TX6 406-1A
Siemens Varistor 3TX6 406-1A pictureSiemens Limit Switch LSO1B
Siemens Limit Switch LSO1B pictureSiemens 3RT1317-1AK60 Contactor 400V Coil 120V 60Hz Size S00 New in Box
Siemens 3RT1317-1AK60 Contactor 400V Coil 120V 60Hz Size S00 New in Box  picturePW0816B1200TC 200-Amp 8-Space 16-Circuit Main Breaker Outdoor Trailer Panel Load
PW0816B1200TC 200-Amp 8-Space 16-Circuit Main Breaker Outdoor Trailer Panel Load picture

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.