Requirement - Desktop application - on Hover of a button should execute a function . How is it possible to give a Action on Hover?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

Hello,

Please check below doc link for more details about onHover event

http://docs.kony.com/konyonpremises/Subsystems/Widget_User_Guide/Content/Box_Events.htm#onHover

For the onHover event defined, you will get the context as parameter. in the context object you will get eventType as property. this eventType property will help you to identify mouse position(enter, move, out).

Please find the below sample.

function onHoverEventCallback(widget,context)

{

kony.print("button hover event executed" + context.eventType);

if (context.eventType == constants.ONHOVER_MOUSE_ENTER)

{

widget.skin = "yellow";

}

else if (context.eventType == constants.ONHOVER_MOUSE_MOVE)

{

widget.skin = "yellow";

}

else if (context.eventType == constants.ONHOVER_MOUSE_LEAVE)

{

widget.skin = "blue";

}

}

if you want to do any flex related operations, please call forceLayout at the end of the event. In this case platform does not call forceLayout(), because hover event(mouse move) will continuously fire.

Hi,

Please do the below steps to achieve your requirement.

  1. Place the button in flexContainer
  2. Apply onHover event to flexContainer
  3. In onHoverEventCallback, write your logic.

Please find the sample app for the same which is working in DesktopWeb channel.

Thanks,

Hi,

Did my response help you? If yes, make sure you click [Select as Best] under the response to close out the post.