cancel
Showing results for 
Search instead for 
Did you mean: 

Bind the button Text by context attribute

Former Member
0 Kudos

Hi All,

I have created dynamic button and setting a text by context attribute(means bind text as context attribute)....But it is not worked...

Here is the code..

String button = wdContext.currentContextElement().getPrintPreviewText();

IWDButton btn_pr =

(IWDButton) view.createElement(IWDButton.class, null);

btn_pr.setEnabled(true);

btn_pr.setText(button);

btn_pr.setOnAction(wdThis.wdGetPrintPreviewAction());

cont.addChild(btn_pr);

Please Tel me....

Thanks & regards

Mathi s

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks For all i solved myself...

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi

IWDAttributeInfo param= wdContext.getNodeInfo.getAttribute ("<context attr name in the root context>");

IWDButton but = (IWDButton)view.createElement(IWDButton.class,"kalyan");

but.bindText( param);

Regards

Kalyan

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi Mati

1.Create a button in wdModify method using view param

2.take the attributeInfo of the context attr that you want to bind with the text property of the button

3.With the help of the button ref see the methods like bindingOfText like that

and pass the IWDAttributeInfo ref of the context attr as aparameter to that method.

4.Make the button enable and add to the Transparent container.

Regards

Kalyan

arun_srinivasan
Contributor
0 Kudos

Hi

Please see the sample code for your question

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

{

//@@begin wdDoModifyView

if(firstTime){

IWDTransparentContainer con=(IWDTransparentContainer)view.getElement("RootUIElementContainer");

IWDButton but11=(IWDButton)view.createElement(IWDButton.class,"but11");

IWDAction act=wdThis.wdCreateAction(IPrivateDynamicProgrammingView.WDActionEventHandler.CLICK,"");

but11.setOnAction(act);

but11.setText("Click");

con.addChild(but11);

}

//@@end

}

Hope this helps,

Regards,

Arun

Former Member
0 Kudos

Hi Mathi,

Is the button getting created on the view? Also check whether the string Button is getting populated properly.

Regards,

Shyam.