cancel
Showing results for 
Search instead for 
Did you mean: 

HOw to capture click event

Former Member
0 Kudos

HI all,

How to capture click event of button?..Please tel me

Thanks & Regards

HB

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Right click on the button in the OutLine view and select properties. In that you will find onAction event for the button. Here you can define a new action for the button.

Is this your question?

thanks & regards,

Manoj

Former Member
0 Kudos

HI ,

Thanks for ur reply.... How to get capture click event..

For example...

if(Action==(click action))

{

}

Please tel me..

Thanks

Former Member
0 Kudos

Hi,

You mean to say that you want to check if that button is clicked or not??

In that case you can create a context attribute say of boolean type and access it anywhere you want to check some condition.

thanks & regards,

Manoj

former_member186016
Active Contributor
0 Kudos

Hi,

When you create and specify a action like "FireAction" for a button, in the attached java file you will have method generated like :

public void onActionFireAction(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionFireAction(ServerEvent)

//@@end

}

This method will be involed when the button is pressed and hence you dont need to check for click action.

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

hi,

Thanks for ur reply...can you give the example code please...?

Thanks

Former Member
0 Kudos

Hi,

First you need to tell your requirement. Is it same as i mentioned in my previous post.

thanks & regards,

Manoj

Former Member
0 Kudos

hi,

when i click button i want to execute the part of code in the modify view.....Is it clear?

Former Member
0 Kudos

Hi,

Then the solution which i have given will do.

Suppose your button is Go:

public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionGo(ServerEvent)

wdContext.currentContextElement().setTest(true);

// Here test is a context attribute.

//@@end

}

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

{

//@@begin wdDoModifyView

if( wdContext.currentContextElement().getTest()){

// Here you can do your part of coding

}

//@@end

}

Hope this will solve your problem.

thanks & regards,

Manoj