on 05-31-2007 7:48 PM
I have an issue with checkbox alignment..
I am creating the checkbox at runtime..My Tray has the layout "Grid Layout" with Col count 2..When i create the checkbox i want to add them vertically..
For example, check box needs to be created as follows:
chk1 chk6
chk2 chk7
chk3 chk8
chk4 chk9
chk5 chk10
But rite now it creates which i dont want this..
chk1 chk2
chk3 chk4
chk5 chk6
chk7 chk8
chk9 chk10
Thanks
BM
Hi Bharathi,
As it is make the col count of tray as 2 with Grid Layout.
Add two containers to Tray.
and set their layout as Grid Layout col count 1.
First fill the first container and then the second one.
Regards,
Nagaraju Donikena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please find the code below which will help you generate the chekboxes as you want
Assuming that node ChkBoxText is the node that has texts to be displayed for the number of
Checkboxes.
RootContainer/Tray colcount is 2
public static void wdDoModifyView(IPrivateFile_Sample_View wdThis, IPrivateFile_Sample_View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
int size = wdContext.nodeChkBoxText().size() ;
int columnSize = size/2; // dividing the totla check boxes by no of columns
int secondColumnnStartIndex = 0;
if(size%2==0)
secondColumnnStartIndex = columnSize;
else
secondColumnnStartIndex = columnSize+1;
IWDTransparentContainer cont = (IWDTransparentContainer) view.getRootElement();
int nodeElements = 0;
int i =0;
for(nodeElements=0;nodeElements<wdContext.nodeChkBoxText().size();nodeElements++)
{//0,1,2,3,4
IWDAttributeInfo Checked_att = wdContext.nodeChkBoxText().getNodeInfo().addAttribute("checked" + i, "ddic:com.sap.dictionary.boolean");
IWDCheckBox chkbox = (IWDCheckBox)view.createElement(IWDCheckBox.class, "checkbox" + i);
chkbox.bindChecked(Checked_att);
chkbox.setText(wdContext.nodeChkBoxText().getChkBoxTextElementAt(i).getTexts());
cont.addChild(chkbox);
nodeElements++;
i++;
if(nodeElements < size)
{//5,6,7,8
IWDAttributeInfo Checked_att1 = wdContext.nodeChkBoxText().getNodeInfo().addAttribute("checked" + secondColumnnStartIndex, "ddic:com.sap.dictionary.boolean");
IWDCheckBox chkbox1 = (IWDCheckBox)view.createElement(IWDCheckBox.class, "checkbox" + secondColumnnStartIndex);
chkbox1.bindChecked(Checked_att1);
chkbox1.setText(wdContext.nodeChkBoxText().getChkBoxTextElementAt(secondColumnnStartIndex).getTexts());
cont.addChild(chkbox1);
secondColumnnStartIndex++;
}
}
}
Output: For odd no of checkboxes (11)
Chk0 Chk6
Chk1 Chk7
Chk2 Chk8
Chk3 Chk9
Chk4 Chk10
Chk5
Output: For even no of checkboxes (10)
Chk0 Chk5
Chk1 Chk6
Chk2 Chk7
Chk3 Chk8
Chk4 Chk9
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
just u change the properties of grid layout COL COUNT =1 then it vl align vertically.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just add them to the container such that you get the wanted layout, i.e. 1,6,2,7,...
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharathi,
You are creating check boxes at runtime in order 1..10.
So, it will not add vertically. It will add horizontally.
Normal placement of any UI element goes from left to right and then top to bottom.
To add checkboxes as you have shown, create two transperant containers.
add 1 to 5 check boxes in first container and add other 5 in second container.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
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.