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

CSG/AMIGA 391077-01 PLCC Integrated Circuit
$12.64
CSG/AMIGA 391077-01 PLCC Integrated Circuit pictureSMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga
$14.99
SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga pictureGeneral Instruments AY3-8915, Color Processor IC, used in Commodore or AMIGA
$2.88
General Instruments AY3-8915, Color Processor IC, used in Commodore or AMIGA pictureSaronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS
$2.75
Saronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS pictureLIA3420, This IC is found on Commodore Amiga board at U800, used
$12.6
LIA3420, This IC is found on Commodore Amiga board at U800, used  picture






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