Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Layout's hover functionality not inherited to its members (isc.Label, isc.Button)

    SmartClient Version: v9.1p_2015-09-16/Pro Development Only (built 2015-09-16)

    Google Chrome version 46

    I have a layout with hover functionality. However, its members do not inherit this hover functionality, specifically a button and label. However, HTMLFlow will inherit it. I would like for the buttons/labels to inherit the hover functionality of its parent layout. Would there be an ideal solution for this? I am thinking of overriding the addMember function to specifically give each component a reference to the parent layout's hover function but this does not seem to be a good solution.

    Expected result: hovering over any member of the layout should trigger the layout's hover functionality.

    Code:
    isc.HLayout.create({
        canHover: true,
        width: 900,
        backgroundColor: "red",
        members:
        [
            isc.Button.create({autoDraw: false, height: "100%"}),
            isc.HTMLFlow.create({contents: "HTMLFlow", backgroundColor: "green"}),
            isc.Label.create({contents: "Label", backgroundColor: "blue"})
        ],
        hover: function()
        {
            isc.say("HI");
        }
    });

    #2
    It's by design that hover behaviors are not "inherited" in the way you are hoping, so the right solution is to add such behaviors as the members are added to the Layout.

    You should not, however, do this via an override of addMember() - this is not documented as an override point that you can assume will be called for all member adds, and may called for internal Layout purposes. Instead, just create yourself a helper method that adds your hover functionality and then calls addMember().

    Comment

    Working...
    X