Home » Eclipse Projects » GEF » Moving Figure, SHIFT or CTRL key is down
Moving Figure, SHIFT or CTRL key is down [message #167523] |
Wed, 09 February 2005 09:29  |
Eclipse User |
|
|
|
Originally posted by: jsk_lam.hotmail.com
Hi,
On moving an figure object with the mouse, I need to test to see
if the SHIFT or CTRL key is pressed down , can someone show
me how to test it? Also, where or which notification method should
I look into for updating the information of the figure being moved?
Thanks
SL
|
|
|
Re: Moving Figure, SHIFT or CTRL key is down [message #167538 is a reply to message #167523] |
Wed, 09 February 2005 09:43   |
Eclipse User |
|
|
|
public class CreationTool
extends TargetingTool
{
.............................................
protected void updateTargetRequest() {
CreateRequest req = getCreateRequest();
if (isInState(STATE_DRAG_IN_PROGRESS)) {
Point loq = getStartLocation();
Rectangle bounds = new Rectangle(loq, loq);
bounds.union(loq.getTranslated(getDragMoveDelta()));
req.setSize(bounds.getSize());
req.setLocation(bounds.getLocation());
req.getExtendedData().clear();
if (!getCurrentInput().isAltKeyDown() && helper != null) {
<------------------------------------------
PrecisionRectangle baseRect = new PrecisionRectangle(bounds);
PrecisionRectangle result = baseRect.getPreciseCopy();
helper.snapRectangle(req, PositionConstants.NSEW,
baseRect, result);
req.setLocation(result.getLocation());
req.setSize(result.getSize());
}
} else {
req.setSize(null);
req.setLocation(getLocation());
}
}
Mostly it depends in which class you want to check key state
"slam" <jsk_lam@hotmail.com> wrote in message
news:cud6n8$jim$1@www.eclipse.org...
> Hi,
>
> On moving an figure object with the mouse, I need to test to see
> if the SHIFT or CTRL key is pressed down , can someone show
> me how to test it? Also, where or which notification method should
> I look into for updating the information of the figure being moved?
>
> Thanks
> SL
>
>
|
|
| | |
Re: Moving Figure, SHIFT or CTRL key is down [message #167598 is a reply to message #167538] |
Wed, 09 February 2005 16:21   |
Eclipse User |
|
|
|
Originally posted by: jsk_lam.hotmail.com
Well, what I need to do is when the user moves the figure,
I need to move all its child nodes along (only when the SHIFT
key is pressed). That is, I need to update all the child node's
location when the parent node is moved. How do I do it?
How to register or use the TargetingTool with the figure?
Thanls
SL
"b00lean" <kk@cleverlance.com> wrote in message
news:cud7jj$nqi$1@www.eclipse.org...
> public class CreationTool
> extends TargetingTool
> {
> ............................................
>
> protected void updateTargetRequest() {
> CreateRequest req = getCreateRequest();
> if (isInState(STATE_DRAG_IN_PROGRESS)) {
> Point loq = getStartLocation();
> Rectangle bounds = new Rectangle(loq, loq);
> bounds.union(loq.getTranslated(getDragMoveDelta()));
> req.setSize(bounds.getSize());
> req.setLocation(bounds.getLocation());
> req.getExtendedData().clear();
> if (!getCurrentInput().isAltKeyDown() && helper != null) {
> <------------------------------------------
> PrecisionRectangle baseRect = new PrecisionRectangle(bounds);
> PrecisionRectangle result = baseRect.getPreciseCopy();
> helper.snapRectangle(req, PositionConstants.NSEW,
> baseRect, result);
> req.setLocation(result.getLocation());
> req.setSize(result.getSize());
> }
> } else {
> req.setSize(null);
> req.setLocation(getLocation());
> }
> }
>
> Mostly it depends in which class you want to check key state
>
> "slam" <jsk_lam@hotmail.com> wrote in message
> news:cud6n8$jim$1@www.eclipse.org...
> > Hi,
> >
> > On moving an figure object with the mouse, I need to test to see
> > if the SHIFT or CTRL key is pressed down , can someone show
> > me how to test it? Also, where or which notification method should
> > I look into for updating the information of the figure being moved?
> >
> > Thanks
> > SL
> >
> >
>
>
|
|
|
Re: Moving Figure, SHIFT or CTRL key is down [message #167629 is a reply to message #167592] |
Wed, 09 February 2005 17:16   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
From your drag tracker, you can call getCurrentInput().isShiftKeyDown().
"slam" <jsk_lam@hotmail.com> escreveu na mensagem
news:cudutd$876$1@www.eclipse.org...
> Well, what I need to do is when the user moves the figure,
> I need to move all its child nodes along (only when the SHIFT
> key is pressed). That is, I need to update all the child node's
> location when the parent node is moved. How do I do it?
> How to register or use the TargetingTool with the figure?
>
> Thanls
> SL
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cudpas$ddj$1@www.eclipse.org...
>> This is already done for you. CTRL turns a drag into a "clone". Shift
>> restricts motion to 45 desgrees.
>> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
>> news:cud6n8$jim$1@www.eclipse.org...
>> > Hi,
>> >
>> > On moving an figure object with the mouse, I need to test to see
>> > if the SHIFT or CTRL key is pressed down , can someone show
>> > me how to test it? Also, where or which notification method should
>> > I look into for updating the information of the figure being moved?
>> >
>> > Thanks
>> > SL
>> >
>> >
>>
>>
>
>
|
|
|
Re: Moving Figure, SHIFT or CTRL key is down [message #167697 is a reply to message #167629] |
Thu, 10 February 2005 01:45   |
Eclipse User |
|
|
|
Originally posted by: jsk_lam.hotmail.com
Hi Randy,
How do I get the drag tracker notification?
Thanks
SL
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cue23s$m37$1@www.eclipse.org...
> From your drag tracker, you can call getCurrentInput().isShiftKeyDown().
>
> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
> news:cudutd$876$1@www.eclipse.org...
> > Well, what I need to do is when the user moves the figure,
> > I need to move all its child nodes along (only when the SHIFT
> > key is pressed). That is, I need to update all the child node's
> > location when the parent node is moved. How do I do it?
> > How to register or use the TargetingTool with the figure?
> >
> > Thanls
> > SL
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:cudpas$ddj$1@www.eclipse.org...
> >> This is already done for you. CTRL turns a drag into a "clone". Shift
> >> restricts motion to 45 desgrees.
> >> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
> >> news:cud6n8$jim$1@www.eclipse.org...
> >> > Hi,
> >> >
> >> > On moving an figure object with the mouse, I need to test to see
> >> > if the SHIFT or CTRL key is pressed down , can someone show
> >> > me how to test it? Also, where or which notification method should
> >> > I look into for updating the information of the figure being moved?
> >> >
> >> > Thanks
> >> > SL
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: Moving Figure, SHIFT or CTRL key is down [message #167914 is a reply to message #167629] |
Fri, 11 February 2005 21:17   |
Eclipse User |
|
|
|
Originally posted by: jsk_lam.hotmail.com
Hi Randy,
I am not using the Drag Tracker at all. Is there a way that I can found
out whether the SHIFT key is pressed (from any code)?
Thanks
SL
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cue23s$m37$1@www.eclipse.org...
> From your drag tracker, you can call getCurrentInput().isShiftKeyDown().
>
> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
> news:cudutd$876$1@www.eclipse.org...
> > Well, what I need to do is when the user moves the figure,
> > I need to move all its child nodes along (only when the SHIFT
> > key is pressed). That is, I need to update all the child node's
> > location when the parent node is moved. How do I do it?
> > How to register or use the TargetingTool with the figure?
> >
> > Thanls
> > SL
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:cudpas$ddj$1@www.eclipse.org...
> >> This is already done for you. CTRL turns a drag into a "clone". Shift
> >> restricts motion to 45 desgrees.
> >> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
> >> news:cud6n8$jim$1@www.eclipse.org...
> >> > Hi,
> >> >
> >> > On moving an figure object with the mouse, I need to test to see
> >> > if the SHIFT or CTRL key is pressed down , can someone show
> >> > me how to test it? Also, where or which notification method should
> >> > I look into for updating the information of the figure being moved?
> >> >
> >> > Thanks
> >> > SL
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: Moving Figure, SHIFT or CTRL key is down [message #168036 is a reply to message #167914] |
Sun, 13 February 2005 20:15  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
So, you are using just draw2d? The mouse event should have as much
information in it as an SWT mouse event. Determining if the SHIFT key is
down is the same as it is in SWT. You could also just look at the code for
the method I pointed you to.
"slam" <jsk_lam@hotmail.com> escreveu na mensagem
news:cujovr$ntv$1@www.eclipse.org...
> Hi Randy,
>
> I am not using the Drag Tracker at all. Is there a way that I can found
> out whether the SHIFT key is pressed (from any code)?
>
> Thanks
> SL
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cue23s$m37$1@www.eclipse.org...
>> From your drag tracker, you can call getCurrentInput().isShiftKeyDown().
>>
>> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
>> news:cudutd$876$1@www.eclipse.org...
>> > Well, what I need to do is when the user moves the figure,
>> > I need to move all its child nodes along (only when the SHIFT
>> > key is pressed). That is, I need to update all the child node's
>> > location when the parent node is moved. How do I do it?
>> > How to register or use the TargetingTool with the figure?
>> >
>> > Thanls
>> > SL
>> >
>> > "Randy Hudson" <none@us.ibm.com> wrote in message
>> > news:cudpas$ddj$1@www.eclipse.org...
>> >> This is already done for you. CTRL turns a drag into a "clone".
>> >> Shift
>> >> restricts motion to 45 desgrees.
>> >> "slam" <jsk_lam@hotmail.com> escreveu na mensagem
>> >> news:cud6n8$jim$1@www.eclipse.org...
>> >> > Hi,
>> >> >
>> >> > On moving an figure object with the mouse, I need to test to see
>> >> > if the SHIFT or CTRL key is pressed down , can someone show
>> >> > me how to test it? Also, where or which notification method should
>> >> > I look into for updating the information of the figure being moved?
>> >> >
>> >> > Thanks
>> >> > SL
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Sun Jun 22 11:56:53 EDT 2025
Powered by FUDForum. Page generated in 0.05429 seconds
|