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 14: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 14:43 |
Karel Kyovsky Messages: 3 Registered: July 2009 |
Junior Member |
|
|
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 #167561 is a reply to message #167523] |
Wed, 09 February 2005 19:46 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
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 #167592 is a reply to message #167561] |
Wed, 09 February 2005 21: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
"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 #167598 is a reply to message #167538] |
Wed, 09 February 2005 21: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 22: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 06: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] |
Sat, 12 February 2005 02: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] |
Mon, 14 February 2005 01: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: Fri Apr 26 22:58:31 GMT 2024
Powered by FUDForum. Page generated in 0.03427 seconds
|