Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

DrawItem and mouse event handling (Chrome)

$
0
0
I would like to handle mouse events on DrawLabel items created in front of a DrawRect item, but no event is fired on them. I can only handle mouse events on the DrawRect drawn in back.

I use:
* SmartClient_v90p_2013-07-14
* Chrome 28.0.1500.95 m

It works fine in IE, not in FireFox.


Code:

// Menu for DrawRect item
isc.Menu.create({
    ID:"RectMenu",
    autoDraw:false,
    width:150,
    data:[
        {title:"RECT"},
        {isSeparator: true},
        {title:"Action1"},
        {title:"Action2"},
        {title:"Action3"}
    ]
});

//Menu for DrawLabel items
isc.Menu.create({
    ID:"LabelMenu",
    autoDraw:false,
    width:150,
    data:[
        {title:"LABEL"},
        {isSeparator: true},
        {title:"Action1"},
        {title:"Action2"},
        {title:"Action3"}
    ]
});

isc.DrawPane.create({
        width: 200, height: 200,
        border: "1px solid gray",
        cursor: "auto",
        drawItems: [
                // If this DrawRect is not created, DrawLabel items receive
                // mouse events as expected
                isc.DrawRect.create({
                        left: 10, top: 10, width: 100, height: 150,
                        contextMenu: RectMenu, //OK
                        mouseOver: function() { // OK
                                isc.logWarn("Enter Rect");
                        },
                        mouseOut: function() { // OK
                                isc.logWarn("Leave Rect");
                        }
                }),
                isc.DrawLabel.create({
                        left: 15, top: 25,
                        contents: "Lab1",
                        contextMenu: LabelMenu, //NOT OK
                        mouseOver: function() { // Never called
                                isc.logWarn("Enter Label: " + this.contents);
                        },
                        mouseOut: function() { // Never called
                                isc.logWarn("Leave Label: " + this.contents);
                        }
                }),
                isc.DrawLabel.create({
                        left: 15, top: 50,
                        contents: "Lab2",
                        contextMenu: LabelMenu, //NOT OK
                        mouseOver: function() { // Never called
                                isc.logWarn("Enter Label: " + this.contents);
                        },
                        mouseOut: function() { // Never called
                                isc.logWarn("Leave Label: " + this.contents);
                        }
                }),
                isc.DrawLabel.create({
                        left: 15, top: 75,
                        contents: "Lab3",
                        contextMenu: LabelMenu, //NOT OK
                        mouseOver: function() { // Never called
                                isc.logWarn("Enter Label: " + this.contents);
                        },
                        mouseOut: function() { // Never called
                                isc.logWarn("Leave Label: " + this.contents);
                        }
                })
        ]
});


Viewing all articles
Browse latest Browse all 4756

Trending Articles