BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-29-2008, 03:42 AM   #1
navneet.gupta
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 19
Default How to get Dialog and popScreen getwidth()

Please Login to Remove!

Hello
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)
{
g.setBackgroundColor(Constants.BACKGROUND_COLOR);
g.clear();
super.paint(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.setColor(0xA9A9A9);
g.drawLine(0,0,Constants.SCREEN_WIDTH,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)
{

super.keyChar(key,status,time);
boolean retval = false;
switch (key)
{
case Characters.ESCAPE:
dialog_Login.cancel();
retval = true;
break;
}
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());


dialog_Login.add(UserName_);
dialog_Login.add(Password_);

dialog_Login.show();
Offline  
Old 04-29-2008, 11:31 AM   #2
richard.puckett
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Default

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.
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


MITSUBISHI Amplifier MR-J2S-200B MRJ2S200B AC Servo Drive New in box picture

MITSUBISHI Amplifier MR-J2S-200B MRJ2S200B AC Servo Drive New in box

$463.00



 MITSUBISHI Amplifier MITSUBISHI MR-J2S-200B MITSUBISHI MRJ2S200B AC Servo Drive picture

MITSUBISHI Amplifier MITSUBISHI MR-J2S-200B MITSUBISHI MRJ2S200B AC Servo Drive

$485.00



Used Fanuc Servo Amplifier A06B-6114-H102 picture

Used Fanuc Servo Amplifier A06B-6114-H102

$869.33



FANUC Servo Amplifier A06B-6096-H206 picture

FANUC Servo Amplifier A06B-6096-H206

$3142.64



HONEYWELL 7800 SERIES- R7847-A-1033 - RECTIFICATION FLAME AMPLIFIER picture

HONEYWELL 7800 SERIES- R7847-A-1033 - RECTIFICATION FLAME AMPLIFIER

$49.99



Voice Amp Amplifier 201141-01 3M Scott EPIC 3 Safety Compatible w AV3000 AV2000 picture

Voice Amp Amplifier 201141-01 3M Scott EPIC 3 Safety Compatible w AV3000 AV2000

$69.99







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