BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   How can I change a labelfield text? (http://www.blackberryforums.com/showthread.php?t=146450)

dynot 08-22-2008 12:35 PM

How can I change a labelfield text?
 
I have a screen with 2 horizontalfieldmanagers and 2 verticalfieldmanagers representing a 4-cell grid. Each cell contains a labelfield with a default value. The code is as follows:

vfmC1.add(new LabelField("r1c1"));

Now I want to set up a listener so that when I enter a value in another part of the screen this LabelField text (r1c1) changes to a new value. I do not want to display another screen or use a dialogbox and would rather just change the value.

How would I go about doing this? I tried this but it doesn't work:

vfmC1.setText("test");

Thanks...

RemyJ 08-22-2008 02:35 PM

You have to run setText() on the label field itself, not the manager...

LabelField lf = new LabelField("r1c1");
vfmC1.add(lf);
lf.setText("test");

dynot 08-22-2008 03:02 PM

Thanks Remy.

I actually tried that but didn't work. I tried it again and its fine now. Probably a noobie mistake the first time around.

Thanks again...


All times are GMT -5. The time now is 07:11 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.