Help: Custom Right Click Context Menu using PopupBehavior Width Problem

Last post 11-29-2006 2:39 PM by David Anson. 1 replies.

Sort Posts:

  • Help: Custom Right Click Context Menu using PopupBehavior Width Problem

    11-23-2006, 2:12 PM
    • Loading...
    • KFrancis
    • Joined on 03-13-2006, 6:40 PM
    • Posts 112

    I've written a custom extender that extends any control that when you right click on the control, a context menu panel is brought up in which the content gets dynamically generated because it uses the DynamicPopulateBase.

    The problem I'm having (IE/Firefox) is that the panel gets wider every time the pop up is shown.

    Now, currently .. my webservice returns html anchors that I generate __doPostBack('__Page', .. ); for so I can cause actions to occur, but I want to stop using postbacks for this because I don't need them for most of the context menu actions. For the most part, the links that are generated should just be calls to some custom javascript which causes my modal popups to appear.

    My previous technique was to use the postback to get the context panel to always appear the correct size .. but I should really fix it.


    Here's the mouse click event handler that I use to populate and show the popup:

    <script type="text/javascript" language="javascript">
        this._onClick = function(e) {
            var rightclick;
            if (!e) var e = window.event;
            if (e.which) rightclick = (e.which == 3);
            else if (e.button) rightclick = (e.button == 2);
            
            if (rightclick) {
                if (!_isVisible) {
                    // Set X/Y?
                    _popupBehavior.set_x(e.offsetX + 5);
                    _popupBehavior.set_y(e.offsetY + 5);
                    _popupBehavior.show();
                    this.populate();
                    _isVisible = true;
                } else {
                    // Set X/Y? 
                    _popupBehavior.set_x(e.offsetX + 5);
                    _popupBehavior.set_y(e.offsetY + 5);
                    _popupBehavior.hide();
                    _popupBehavior.show();
                    this.populate();
                }
                window.event.returnValue = false;
            } else {
                _popupBehavior.hide();   
                _isVisible = false;
            }
            return false;
        }
    </script>
    Any suggestions? 
  • Re: Help: Custom Right Click Context Menu using PopupBehavior Width Problem

    11-29-2006, 2:39 PM
    As I recall, this happens when the popup target has a border/padding style due to a bug in the popup behavior in Atlas. Since we've inherited this code, I've opened work item 6065 to look at fixing it. In the meantime, you can consider stripping the border/padding from the popup target. Thanks!
    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter