on 05-09-2007 2:16 PM
Hi All,
I have created a Tab under a TabStrip dynamically. Under the Tab I have added two UIElements one is label and another is InputField. Now when I run the application only input field is displaying because of InputField is overlaping the label. I think we have to set the layout to gridLayout and colcount to 2. I have also created a Tab dynamically and under this Tab, TransparentContainer was defaultly created. I changed the layout to GridLayout and colcount to 2. Then I could find both Label and Input fields on the screen.
The same way i have to define the properties for Tab, for that we need to know the TransparentContainer for this Tab. I could not find the way how to find the Transparent container.
Can any body tell me how to find the TransparentContainer for the Tab and how to set the Layout for this TransparentConatianer dynamically.
below is my code......
IWDTransparentContainer theActionContainer =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDTabStrip ts = (IWDTabStrip) view.createElement(IWDTabStrip.class,"TabStrip");
IWDTab tab1 = (IWDTab) view.createElement(IWDTab.class,wdContext.currentContextElement().getVar1().toString());
tab1.setVisible(true);
//IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getAttribute("var1");
//in.bindValue(attrInfo);
IWDAttributeInfo attrinfo1= wdContext.getNodeInfo().getAttribute("var1");
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
in.bindValue(attrinfo1);
IWDCaption header1 = (IWDCaption) view.createElement(IWDCaption.class,"Header1");
header1.setText(wdContext.currentContextElement().getVar1());
tab1.setHeader(header1);
tab1.setContent(in);
ts.addTab(tab1);
ts.setWidth("100%");
theActionContainer.addChild(ts);
theActionContainer.setWidth("100%");
Please help me in solving this issue.....
Thanks in Advance..
Murthy.
Hi,
You need to create the tab header and content container in addition to creating the content within the tab... See below.
if (firstTime)
{
IWDTabStrip tabs = (IWDTabStrip)view.getElement("TabStrip");
//create the tab
IWDTab tab = (IWDTab)view.createElement(IWDTab.class, "Tab");
tabs.addTab(tab);
//create the header
IWDCaption caption = (IWDCaption)view.createElement(IWDCaption.class, tab.getId() + "_header");
caption.setText("Tab Text");
tab.setHeader(caption);
//create the content container
IWDTransparentContainer transContainer = (IWDTransparentContainer)view.createElement(IWDTransparentContainer.class, tab.getId() + "_content");
IWDGridLayout gridLayout = (IWDGridLayout)transContainer.createLayout(IWDGridLayout.class);
gridLayout.setColCount(2);
tab.setContent(transContainer);
//create the content
caption = (IWDCaption)view.createElement(IWDCaption.class, "Caption");
caption.setText("Caption Text");
IWDGridData gridData = (IWDGridData)caption.createLayoutData(IWDGridData.class);
transContainer.addChild(caption);
IWDInputField inputField = (IWDInputField)view.createElement(IWDInputField.class, "InputField");
inputField.bindValue(wdContext.getNodeInfo().getAttribute("Attribute"));
gridData = (IWDGridData)inputField.createLayoutData(IWDGridData.class);
transContainer.addChild(inputField);
//set the selected tab
tabs.setSelectedTab(tab.getId());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
for your code,
theActionContainer.createLayout(IWDGridLayout.class);
just after this:
IWDTransparentContainer theActionContainer =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
hope it helps
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhijeet,
the code you specified is not worked. This Code is to set layout for root of Tabstrips, but i want to set the layout for Tabs .
I think the problem is not clear to you. Here is the hierarchy..
RootUIElementContainer
|----->TabStrip
|------>Tabs0
when we creat this Tabs0 , TransparentContainer will be creted defaulty under this Tabs0 as shown below
Tabs0
|---->TransparentConatainer
under this transparent container our UIElements will be added.
We can set layout for this TransparentContainer to gridlayout, because it was designed at design time.
Now i want to do the same scenario for runtime. As i told , have created TabStrips and Tabs and UIElements, only thing pending is need to set the layout for this TransparentContainer.
Hope my problem is clear now...
Thanks & Regards
Murthy,
The following code adds a container inside a Tab, assigns a MatrixLayout to it and adds a label and an input field such that they form a row:
wdDoModifyView():
IWDTab tab = ...;
IWDTransparentContainer c = (IWDTransparentContainer) view.createElement(IWDTransparentContainer.class, null);
tab.setContent(c);
IWDMatrixLayout layout = c.createLayout(IWDMatrixLayout.class);
layout.setStretchedHorizontally(false); /* default is somewhat stupid */
IWDLabel label = ...;
label.createLayoutData(IWDMatrixHeadData.class); /* will start new row */
c.addChild(label);
IWDInputField input = ...;
inputField.createLayoutData(IWDMatrixData.class); /* stays in same row */
c.addChild(input);
Armin
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.