cancel
Showing results for 
Search instead for 
Did you mean: 

Extend standard SAPUI5 control "Button" to add functionnality : allowHover property

chaouki_akir
Contributor
0 Kudos
418

Hello,

there is a learning journey develop-sapui5-applications 

In a following part, --> Working with UI5-Controls --> Developing a Standard Control Extension , there are tasks.

I have a question about the task 1 "Extend the Button Control".

github HoverButton.jpg

For this task 1, we create a control file HoverButton.js. We add a property "allowHover".

I tried to find this property in the documentation (ui5.sap.com). But i don't find it anywhere.

Where can I find the definition of that property ?

 

PS : 

If you want to do the exercise, you can start from here : Developing a Full-screen Application

Or the solution can be found here 

 

View Entire Topic
Lydie
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

The idea here is to extend the control, so indeed add a new property that does NOT exist yet. 

So we are creating a new allowHover property on the Button. The purpose is to be able to change that property from true to false, and write code that triggers the hover event if the property is set to true.

When you create a new property, a get method is automatically added also. That's why you use the following code in the onmouseover event : if(this.getAllowHover()) {...}

If you want to change the name of the property you also need to change the name of the function, so for example if you name the property xxallowHover then you have to use the function getXxallowHover().

Hope that helps.