After weekend I tried again and it worked very well... I don't know the
reason for the not working code last week, but here is my code, that worked
very well:

@Override
public void onMouseMove(Widget sender, int x, int y) {
  super.onMouseMove(sender, x, y);
  if (this.getPopupLeft() + this.getOffsetWidth() > Window.getClientWidth())
{
    this.setPopupPosition(Window.getClientWidth() - this.getOffsetWidth(),
this.getPopupTop());
  }
  if (this.getPopupTop() + this.getOffsetHeight() >
Window.getClientHeight()) {
    this.setPopupPosition(this.getPopupLeft(), Window.getClientHeight() -
this.getOffsetHeight());
  }
}

The dialog window does not move out of the visible window area!
Thank you very much Sumit! The idea of overriding the onMouse- Events is THE
idea!

-Danny

2009/3/5 Sumit Chandel <sumitchan...@google.com>

> Hi Danny,
> That shouldn't be the case. Which browser were you testing on when this
> occurred?
>
> I ran the code snippet below and tested it out in hosted IE6, web mode
> IE6/7/8, FF3 and Chrome, and in all cases the onMouseUp() method was called
> and the dialog box was repositioned. Give it a try and let me know how it
> looks for you.
>
> public void onModuleLoad() {
>   final DialogBox dialogBox = new DialogBox() {
>     public void onMouseUp(Widget sender, int x, int y) {
>       this.setPopupPosition(0, 0);
>       super.onMouseUp(sender, x, y);
>     }
>   };
>   dialogBox.setHTML("<b>Bonjour la police!</b>");
>   RootPanel.get().add(dialogBox);
>   dialogBox.center();
> }
>
> Hope that helps,
> -Sumit Chandel
>
> On Thu, Mar 5, 2009 at 12:20 AM, Danny Schimke 
> <schimk...@googlemail.com>wrote:
>
>> It does not work. The onMouseUp is never called...
>>
>> 2009/2/27 Sumit Chandel <sumitchan...@google.com>
>>
>> Hi Danny,
>>> Here's one possible solution - you could override the
>>> DialogBox.onMouseUp() method to re-position the dialog box depending on
>>> where it was when the user lets go of it.
>>>
>>>  For example:
>>>
>>> final DialogBox dialogBox = new DialogBox() {
>>>   public void onMouseUp(Widget sender, int x, int y) {
>>>     if(exceedsBounds(x,y) {
>>>       this.setPopupPosition(xpos, ypos);  //recenter to boundary edge or
>>> center page
>>>     }
>>>     super.onMouseUp(sender, x, y);
>>>   }
>>> };
>>>
>>> Hope that helps,
>>> -Sumit Chandel
>>>
>>> On Mon, Feb 23, 2009 at 6:04 AM, Danny Schimke <schimk...@googlemail.com
>>> > wrote:
>>>
>>>> No idea?
>>>>
>>>> 2009/1/28 Danny Schimke <schimk...@googlemail.com>
>>>>
>>>>  Hello!
>>>>>
>>>>> Is it possible to restrain the DialogBox to move out on right and
>>>>> bottom side of the browsers windows? When I move the box over it's header 
>>>>> it
>>>>> should stay completely in the visible browser window area, because I
>>>>> disabled the scroll bars and the user should not be able to move the
>>>>> DialogBox in a not viewed area.
>>>>>
>>>>> And second: in IE6 the DialogBox is only dragable by the text in it's
>>>>> header. Is there a clean way to allow IE6 users to drag&drop the box like 
>>>>> in
>>>>> FF or IE7 over the complete header?
>>>>>
>>>>> Thank you very much!
>>>>>  - Danny
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to