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
PIN: N/A
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!

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 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


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

100pcs 35V 560uF 35V NCC Nippon LXV 10x25mm Low impedance Capacitor
$15.99
100pcs 35V 560uF 35V NCC Nippon LXV 10x25mm Low impedance Capacitor pictureNEW Zareba Pro Series 50 Mile AC Low Impedance Electric Fence Charger EAC50M-Z
$92.99
NEW Zareba Pro Series 50 Mile AC Low Impedance Electric Fence Charger EAC50M-Z  pictureESI 252 Impedance Meter POWERS ON
$68.85
ESI 252 Impedance Meter POWERS ON picture200pcs 35V 390uF 35V NCC KZH 8x20mm Low Impedance Long Life Capacitor
$19.99
200pcs 35V 390uF 35V NCC KZH 8x20mm Low Impedance Long Life Capacitor pictureAgilent HP 4396A 100 kHz - 1.8 GHz RF Network / Spectrum / Impedance Analyzer
$99.0
Agilent HP 4396A 100 kHz - 1.8 GHz RF Network / Spectrum / Impedance Analyzer   picture






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