BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-08-2007, 09:41 AM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8100
PIN: N/A
Carrier: 1
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Accessing Components of a screen in fieldlistener

Please Login to Remove!

Hi to all,

I have an application(Developed by JDE4.2.1.40) with two ButtonField(Labelled Button1, Button2) and one Textfield in screen1.

I need to update the TextField with the label of the button clicked.

If Button1 is clicked, TextField should have the value 'Button1'.

If Button2 is clicked, TextField should have the value 'Button2'.

I can get the label of clicked button.

But how can update it in the TextField.

How can i access the TextField of the screen?

I've tried with screen1.TextField1.

But it not works.

In short, My Question is how can i access the components of a screen in FieldListener class of a button which is in the same screen?

Thanks in advance.
Offline  
Old 08-08-2007, 10:52 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think what you want to do is access the static UIApplication.getActiveScreen().getField(with some number). If you want to update an object, set the contents of the new object and then call the invalidate method on that particular object.
Offline  
Old 08-08-2007, 11:02 PM   #3 (permalink)
Thumbs Must Hurt
 
Rose's Avatar
 
Join Date: Nov 2006
Location: India
Model: 9700
OS: Windows 7
Carrier: Airtel
Posts: 121
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
If the screen 1 is the active screen then

In the trackwheelclick method{

Field field = this.getLeafFieldWithFocus();
if(field.equals(button1)){ //button1 is Buttton 1's object
textField.setText(button1.getlabel());
}
else if(field.equals(button2)){ //button2 is Buttton 2's object
textField.setText(button2.getlabel());
}
}
Offline  
Old 08-15-2007, 02:11 AM   #4 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8100
PIN: N/A
Carrier: 1
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Talking Thanks ROSE

Quote:
Originally Posted by Rose View Post
Hi,
If the screen 1 is the active screen then

In the trackwheelclick method{

Field field = this.getLeafFieldWithFocus();
if(field.equals(button1)){ //button1 is Buttton 1's object
textField.setText(button1.getlabel());
}
else if(field.equals(button2)){ //button2 is Buttton 2's object
textField.setText(button2.getlabel());
}
}
Many thanks for your kind reply.
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

Lot of RAM Desktop Memory Sticks PC133 PC2 PC333 128MB 256MB 512MB 1GB
$46.49
Lot of RAM Desktop Memory Sticks PC133 PC2 PC333 128MB 256MB 512MB 1GB pictureLot of 15 Allen Bradley Memory Segment, # 1772-MS, 2048 Word Ram, Used
$0.99
Lot of 15 Allen Bradley Memory Segment, # 1772-MS, 2048 Word Ram, Used pictureDRAM 64kx1 Dynamic RAM 64k x 1 150ns HM4864P-2 HM4864AP-12 MB8264-12
$4.99
DRAM 64kx1 Dynamic RAM 64k x 1 150ns HM4864P-2 HM4864AP-12 MB8264-12 pictureGoodway RAM-4-60 Rotary Chiller Tube Cleaner w/Foot Switch
$1187.5
Goodway RAM-4-60 Rotary Chiller Tube Cleaner w/Foot Switch pictureGreenlee Hydraulic Knockout 767 Pump & Ram
$699.99
Greenlee Hydraulic Knockout 767 Pump & Ram  picture






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