on 11-14-2006 7:49 AM
Hi ,
I am creating UI elements Check box in a view dynamically at runtime.
But its is in uneditable mode.(gray out)
-
my Code:
-
IWDCheckBox cb1 = (IWDCheckBox)view.createElement (IWDCheckBox.class,optdetials[1]);
cb1.setText(optdetials[2]);
root.addChild(cb1);
-
Now my problem is how to make this check box enable.
and aslo tell me how to create Radio button dynamically.
Thanks
Ravi
Hi Ravi,
Go through the following
Follow the below steps:
1. Create a ValueAttribute "ChkGroup" and following valueattributes under the above valueattribute
check (boolean)
text (string)
2. Type the following in init() method
IPrivate<<VIEW>>.IChkGroupElement ele=wdContext.createChkGroupElement();
ele.setCheck(true);
ele.setText("1");
wdContext.nodeChkGroup().addElement(ele);
IPrivate<<VIEW>>.IChkGroupElement ele1=wdContext.createChkGroupElement();
ele1.setCheck(true);ele1.setText("11");
wdContext.nodeChkGroup().addElement(ele1);
3. Write the following in wdDoModifyView() method
IWDCheckBoxGroup grp1=(IWDCheckBoxGroup)view.createElement(IWDCheckBoxGroup.class,null);
grp1.bindTexts("ChkGroup.text");
grp1.bindEnabled("ChkGroup.check");
<<Container>>.addChild(grp1);
Regards, Anilkumar
Message was edited by:
Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a value attribute "checked" of type boolean.
Now try the following
IWDCheckBox cb1 = (IWDCheckBox)view.createElement (IWDCheckBox.class,null);
cb1.setText("Text");
cb1.bindChecked("checked");
"Checked" property is the one you need to makesure while creating the checkbox.This property should be bound to a valueattribute of type boolean
Regards, Anilkumar
Message was edited by:
Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi
No, You can't create CheckBox without binding to the context because it needs to save value of 'checked' property somewhere. Context is the only place for storing 'checked' property. The same is for RadioButton. You need to bind its 'selectedKey' property to the context.
If you need to create several check boxes dynamically you have to create dynamically the boolean attributes in the context too... and use them for binding.
Another possible way in your case is using CheckBoxGroup. The control will display required number of check boxes dunamically based on the number of elements in the context node bound to it. Let me if you need more info about the control.
BR
Sergei
Hi,
check this link
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/5c8500cd-0401-0010-d49e-af15579891a7
Thanks,
Lohi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.