Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
Accepted Solution

checkboxfield question

Hi!

 

I want to add checkboxes in a dinamic way to the main manager.

 

while (reItems.hasNextElement())
			{
ck1 = new CheckboxField(string, boolean);
add(ck1);
}

 

Later I want to get the value of each one. How should I do it?

................................................................................................
Tech On!
PTNews
more at On On On!
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: checkboxfield question

Take the array of checkbox Fields.

 

CheckboxField checkbox[];
checkbox=new CheckboxField[size of your reItems];

while(reItems.hasNextElement)
{
     checkbox[value]=new CheckboxField("Name", false);
     add(checkbox[value]);
}

 Then you can get values of each one.

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Developer
lakshman9687
Posts: 243
Registered: ‎07-22-2011
My Device: BlackBerry Z10

Re: checkboxfield question

Hi,

 

u can get the values from the manager itself. i.eyou are adding to any of the manager like below so u can get

Field f = vfm.getFieldAt(index);

from this u can get the field then type cast the field with checkbox and get the value from that...

 

Thanks..

 

while (reItems.hasNextElement())
			{
ck1 = new CheckboxField(string, boolean);
vfm.add(ck1);
}
----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

Please use plain text.
Developer
tklanilkumar
Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800

Re: checkboxfield question

for CheckboxField

getLabel();//retrieves the checkbox label

getChecked();// gives you the check box state , if it selected returns true els efalse.
*****************************************************************************
* Give kudos when you like it
* Mark it as a solution if it fixes your issue
Please use plain text.
Developer
pradeep_ch
Posts: 543
Registered: ‎12-23-2010
My Device: Z10

Re: checkboxfield question

[ Edited ]

I think getting field from manager through index is not a better approach, If you really need to face this situation then create a custom field by extending checkbox field and add another property like index or some thing else.
now in the checkbox field  click event you can check that field with that additional property which you added.

Thanks.

Please use plain text.
Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520

Re: checkboxfield question

Hi, thank you all for the help.

 

I've followed alishaik786 suggestion and everything is working OK.

 

Thank you al!l

................................................................................................
Tech On!
PTNews
more at On On On!
Please use plain text.