BlackBerryForums.com : Your Number One BlackBerry Community      

»Sponsored Links




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

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.
   
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
bemshaswing Offline
Talking BlackBerry Encyclopedia
 
Posts: 201
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Default 08-08-2007, 11:52 AM

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.
   
  (#3 (permalink)) Old
Rose Offline
Thumbs Must Hurt
 
Rose's Avatar
 
Posts: 120
Join Date: Nov 2006
Location: India
Model: 8100
Carrier: Airtel
Default 08-09-2007, 12:02 AM

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());
}
}
   
  (#4 (permalink)) Old
paramasivan Offline
New Member
 
Posts: 14
Join Date: Aug 2007
Model: 8100
PIN: N/A
Carrier: 1
Talking Thanks ROSE - 08-15-2007, 03:11 AM

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.
   
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-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1