Saturday, October 5, 2013

what is the shortest code to make sure a dialogbox to stay inside an area when users try to move it out of that area?

Ok, let say I want my dialogbox to be moved within an area that have 500px width & 600px height. 

The rule is that If the users move the dialogbox out of that area, then the dialogbox will stay at where it was right at the point that it will be about to break the rule.

int currentTop=dialogBox.getPopupTop();
int currentLeft=dialogBox.getPopupLeft();

Ex: if the left of the dialogbox >500px & top >600px then .setPopupPosition(500, 600);
if  the left of the dialogbox >500px & top <600px & top>0 then .setPopupPosition(500, currentTop);
if  the left of the dialogbox <500px & >0 & top <600px & top>0 then .setPopupPosition(currentLeft, currentTop);
.... there are many other cases,

So what is the shortest code to make sure a dialogbox to stay inside an area when users try to move it out of that area, see an ex like this

U will see that u can't move the object out of the constrained area.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate