BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-08-2007, 10: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, 11: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-09-2007, 12:02 AM   #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, 03: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





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