:: Forum >> Version 2 >>

Combo poblem on safari

Hi Alex,

The popup for the combo seems to be misplaced in Safari using the code below on AW 2.5.4.
Do you know of any workarounds ?

Thanks,
Ankur

<html>
<
head>
    <
script src="runtime/lib/aw.js" type="text/javascript"></script>
    <
link href="runtime/styles/system/aw.css" rel="stylesheet">
</
head>
<
body>

<
div style="overflow: scroll; width: 400px; height: 200px; border: 1px solid green;">
<
div style="width: 800px; height: 400px; border: 1px solid red;">
Lorem ipsum dolor sit ametconsectetur adipiscing elitDonec ultrices turpis cursus sem porta
<span id="combo1"></span>
</
div>
</
div>

<
script type="text/javascript">
    var 
itemTextArray = ["Home""Favorites""Font size""Search"];
    var 
itemImageArray = ["home""favorites""fontsize""search"];
    
    var 
combo = new AW.UI.Combo;
    
combo.setId("combo1");
    
combo.setControlText("Combo");
    
combo.setControlImage("favorites");
    
combo.setItemText(itemTextArray);
    
combo.setItemImage(itemImageArray);
    
combo.setItemCount(4);
    
combo.refresh();
    
</
script>
</
body>
</
html>
 
Ankur Motreja
Tuesday, July 14, 2009
Here is the patch which should solve this both on Safari4/Chrome and Safari 3 -

if (AW.webkit){
    if (
document.documentElement.getBoundingClientRect){ // Safari 4

        
AW.getLeft = function(element){
            return 
element.getBoundingClientRect().left;
        };

        
AW.getTop = function(element){
            return 
element.getBoundingClientRect().top;
        };
    }
    else {

        
AW.getLeft = function(element){
            return 
webkitGetRectangle(element).left webkitGetScroll(element).left;
        };

        
AW.getTop = function(element){
            return 
webkitGetRectangle(element).top webkitGetScroll(element).top;
        };

        var 
webkitGetRectangle = function(e){

            var 
e00;

            function 
getPos(el){
                if (!
el) {
                    return {
x:0y:0};
                }
                if (
el == document.body.parentNode){
                    return {
x:0y:0};
                }
                if (
el == document.body){
                    return {
x:el.offsetLefty:el.offsetTop};
                }

                var 
el.offsetParent;

                var 
pp getPos(p);

                return {
                    
xel.offsetLeft pp.x,
                    
yel.offsetTop pp.y};
            }

            var 
pp getPos(e);

            return {
                
leftpp.x,
                
rightpp.e.offsetWidth,
                
toppp.y,
                
bottompp.e.offsetHeight
            
};
        };


        var 
webkitGetScroll = function(e){

            var 
= {left0top0};

            
e.parentNode;

            while (
&& !== document.body && !== document.documentElement){
                
s.left += e.scrollLeft;
                
s.top += e.scrollTop;
                
e.parentNode;
            }

            return 
s;
        };
    }
}
 
Alex (ActiveWidgets)
Wednesday, July 15, 2009
Thanks Alex.
That works fine.

Thanks,
Ankur
Ankur Motreja
Thursday, July 16, 2009
Fixed in AW 2.5.5 -
http://www.activewidgets.com/general.bugs/2-5-5.html
Alex (ActiveWidgets)
Friday, September 25, 2009



This topic is archived.

Back to support forum

Forum search