cancel
Showing results for 
Search instead for 
Did you mean: 

Create Dynamic button

Former Member
0 Kudos

can anyone guide me to create dynamic button? Thank you,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pankaj,

This is what you need:

public static void wdDoModifyView(IPrivateStamappView wdThis, IPrivateStamappView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime){

IWDButton button = (IWDButton) view.createElement(IWDButton.class,"myButtomid");

IWDTransparentContainer myCont = (IWDTransparentContainer) view.getRootElement();

myCont.createLayout(IWDMatrixLayout.class);

myCont.addChild(button,0);

}

//@@end

}

Regards

Nir

Answers (2)

Answers (2)

Former Member
0 Kudos

thanks a lot

Former Member
0 Kudos
wdDoModifyView(...)
{
  IWDButton button = (IWDButton) view.createElement(IWDButton.class, null);
  button.setOnAction(wdThis.wdGet<Action>Action());
  <someContainer>.addChild(button);
}

If you have defined an action named <Action> with a text and an icon, the button will inherit text and icon from that action and pressing the button will call the event handler of that action.