cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic creation of TabStrips

Former Member
0 Kudos

Hi

I am trying to create a dynamic tabstrip control. When i try to add UI elements Label and Inputfield, the only visible uielement on the tab is the Inputfield. Can any one provide some help on this.

thanks

Ravi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi armin

Thanks. I will try it out and let u know.

ravi

Former Member
0 Kudos

How do you add the content to a tab? It should look like this:


IWDTabStrip tabstrip = ...;
IWDTab tab = (IWDTab) view.createElement(IWDTab.class, "tab");
IWDScrollContainer content = (IWDScrollContainer) view.createElement(IWDScrollContainer.class, "tabContent");
IWDLabel label = (IWDLabel) view.createElement(IWDLabel.class, "label");
IWDInputField field = (IWDInputField) view.createElement(IWDInputField.class, "field");
content.addChild(label);
content.addChild(field);
tab.setContent(content);
tabstrip.addTab(tab);
// etc.  

Don't forget to assign a suitable layout to the content container and to assign suitable layout data to its children.

Armin

Former Member
0 Kudos

I used your code-example within "wdDoModifyView" and surrounded the block with

if (firstTime) {

...your example-code;

}

Is this the right position?

I placed a IWDTabStrip-Element during designtime, and I assigned already one IWDTab during desingtime. With your code-example I tried to add further IWDTabs at runtime.

Problem: The dynamicly created IWDTabs are only shown,

- if I call the "requestFocus"-Method of an Element, which is placed on the newly created IWDTabs, or

- if I press a "ToolbarButton" of the IWDTabStrip.

It seems that the IWDTabStrip needs some kind of "refresh". Any idea?

Former Member
0 Kudos

That sounds strange. There is no "refresh" or something similar needed.

The "firstTime" parameter in wdDoModifyView() indicates, if the view is displayed for the first time. Normally, dynamic additions to the static view layout will be done, if firstTime = true. So you can use as the first statement


if ( !firstTime) return;

Which version and which client (CSF, HTML) of Web Dynpro are you using? Perhaps you can post your code to check if there is something missing.

Armin

Former Member
0 Kudos

ok, I found the error, and it was my error, sorry...

When I display the view I load data from a backend-system; this is done in the event-handler of my Inbound-Plug. During this method an Excepiton occured, which I reported to the Component-MessageManager in the following way:

wdThis.wdGetAPI().getComponent().getMessageManager().reportException("some error message", <b>true</b>);

The parameter "cancelNavigation = true" had the effect, that the "wdDoModifiyView"-Method has not been called anymore.

I changed this value to false, and now "wdDoModifiyView" is called!

diegohs
Active Participant
0 Kudos

Hi Armin,

I'm trying to do the same thing: create a tabstrip dynamically.

I have a question about the first line of your sample code:

IWDTabStrip tabstrip = ...;

In this case, the tabstrip is created during design right? I create TabStrip1 object during design time, how can I make reference to that object ?

Regards,

Diego

Former Member
0 Kudos

IWDTabStrip tabstrip = (IWDTabStrip)
  view.getElement("TabStrip1");

Armin