Re: 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?
my question is all about logic, it not specific to any lang, there should be a way to control that elegantly. On Sunday, October 6, 2013 7:17:15 AM UTC+11, GWTter wrote: > > Actually I realized that you were asking specifically about a Dialog box > (my initial answer was based on basic DnD). If you're overriding the > *Dragging methods then you can just check the mouse position from the > events like I said. > > On Saturday, October 5, 2013 10:11:27 PM UTC+2, GWTter wrote: >> >> I know you said shortest code but that's too arbitrary of a request >> considering that it would depend on your code too, >> >> On Saturday, October 5, 2013 10:09:35 PM UTC+2, GWTter wrote: >>> >>> The only way the the popup is going to drag (barring the use of native >>> dnd) is if you adjust its top and left. If you can move your popup then you >>> should already be adjusting the top and left in your code. The popup isn't >>> going to be aware that it's moving (keeping in mind good design) so you >>> should be adjusting its position based on the mouse position relative to >>> the popup and its client coordinates. So just check your mouse position >>> relative to the popup to see if its going out of bounds in which case you >>> stop adjusting the popup position. >>> >>> On Saturday, October 5, 2013 7:41:43 PM UTC+2, Tom wrote: >>>> >>>> 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 >>>> https://gwt-dnd.appspot.com/#WindowExample >>>> >>>> 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+unsubscr...@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.
Re: 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?
Actually I realized that you were asking specifically about a Dialog box (my initial answer was based on basic DnD). If you're overriding the *Dragging methods then you can just check the mouse position from the events like I said. On Saturday, October 5, 2013 10:11:27 PM UTC+2, GWTter wrote: > > I know you said shortest code but that's too arbitrary of a request > considering that it would depend on your code too, > > On Saturday, October 5, 2013 10:09:35 PM UTC+2, GWTter wrote: >> >> The only way the the popup is going to drag (barring the use of native >> dnd) is if you adjust its top and left. If you can move your popup then you >> should already be adjusting the top and left in your code. The popup isn't >> going to be aware that it's moving (keeping in mind good design) so you >> should be adjusting its position based on the mouse position relative to >> the popup and its client coordinates. So just check your mouse position >> relative to the popup to see if its going out of bounds in which case you >> stop adjusting the popup position. >> >> On Saturday, October 5, 2013 7:41:43 PM UTC+2, Tom wrote: >>> >>> 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 >>> https://gwt-dnd.appspot.com/#WindowExample >>> >>> 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+unsubscr...@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.
Re: 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?
I know you said shortest code but that's too arbitrary of a request considering that it would depend on your code too, On Saturday, October 5, 2013 10:09:35 PM UTC+2, GWTter wrote: > > The only way the the popup is going to drag (barring the use of native > dnd) is if you adjust its top and left. If you can move your popup then you > should already be adjusting the top and left in your code. The popup isn't > going to be aware that it's moving (keeping in mind good design) so you > should be adjusting its position based on the mouse position relative to > the popup and its client coordinates. So just check your mouse position > relative to the popup to see if its going out of bounds in which case you > stop adjusting the popup position. > > On Saturday, October 5, 2013 7:41:43 PM UTC+2, Tom wrote: >> >> 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 >> https://gwt-dnd.appspot.com/#WindowExample >> >> 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+unsubscr...@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.
Re: 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?
The only way the the popup is going to drag (barring the use of native dnd) is if you adjust its top and left. If you can move your popup then you should already be adjusting the top and left in your code. The popup isn't going to be aware that it's moving (keeping in mind good design) so you should be adjusting its position based on the mouse position relative to the popup and its client coordinates. So just check your mouse position relative to the popup to see if its going out of bounds in which case you stop adjusting the popup position. On Saturday, October 5, 2013 7:41:43 PM UTC+2, Tom wrote: > > 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 > https://gwt-dnd.appspot.com/#WindowExample > > 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+unsubscr...@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.
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 https://gwt-dnd.appspot.com/#WindowExample 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+unsubscr...@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.