Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Changeing Z-order
Changeing Z-order [message #151109] Wed, 15 September 2004 17:35 Go to next message
Eclipse UserFriend
Originally posted by: dave.derry.equifax.com

There was a post a few days ago regarding changing the Z-order of a
Figure. The response suggested removing the Figure from it's container &
readding it to move it to the top of the Z-order. This sounded like a
reasonable suggestion to me, and I thought that it would improve the
dragging of Figures in my application. I have never really liked having
the Figure that I am dragging disappear behind another figure.

So I modified the start of dragging to do as suggested to move the
Figure to the top of the Z-order. The problem is that when removing the
Figure from the container Figure removeNotify() is called which calls
requestRemoveFocus() in SWTEventDispatcher. requestRemoveFocus() (among
other things) sets mouseTarget to null, and the Figure no longer
responds to the MouseMoveEvents. Actually, if I drag outside the border
of the Figure, release the mouse button, press the mouse button, and
drag back inside the border of the Figure, it reattaches, and I can drag
the Figure around. But I don't think that I will be able to train my
users to do that. ;-}

Anyone know of any work-arounds that will allow me to bring the Figure
to the top of the Z-order, and still drag it?

TIA,
Dave Derry
Re: Changeing Z-order [message #151171 is a reply to message #151109] Thu, 16 September 2004 06:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eostroukhov.hotmail.com

I'm just about to implement the feature in our project and what I'm going to
do is to return children in another order from the getModelChildren method
of the container EditPart.

"Dave Derry" <dave.derry@equifax.com> wrote in message
news:ci9u98$lb9$1@eclipse.org...
> There was a post a few days ago regarding changing the Z-order of a
> Figure. The response suggested removing the Figure from it's container &
> readding it to move it to the top of the Z-order. This sounded like a
> reasonable suggestion to me, and I thought that it would improve the
> dragging of Figures in my application. I have never really liked having
> the Figure that I am dragging disappear behind another figure.
>
> So I modified the start of dragging to do as suggested to move the
> Figure to the top of the Z-order. The problem is that when removing the
> Figure from the container Figure removeNotify() is called which calls
> requestRemoveFocus() in SWTEventDispatcher. requestRemoveFocus() (among
> other things) sets mouseTarget to null, and the Figure no longer
> responds to the MouseMoveEvents. Actually, if I drag outside the border
> of the Figure, release the mouse button, press the mouse button, and
> drag back inside the border of the Figure, it reattaches, and I can drag
> the Figure around. But I don't think that I will be able to train my
> users to do that. ;-}
>
> Anyone know of any work-arounds that will allow me to bring the Figure
> to the top of the Z-order, and still drag it?
>
> TIA,
> Dave Derry
>
Re: Changeing Z-order [message #151325 is a reply to message #151171] Fri, 17 September 2004 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dave.derry.equifax.com

Thanks for the response. I'm afraid that I can't do that. I'm not
actually using GEF; I'm just using draw2d hosted in an SWT Canvas.

Dave

Eugene Ostroukhov wrote:
> I'm just about to implement the feature in our project and what I'm going to
> do is to return children in another order from the getModelChildren method
> of the container EditPart.
>
> "Dave Derry" <dave.derry@equifax.com> wrote in message
> news:ci9u98$lb9$1@eclipse.org...
>
>>There was a post a few days ago regarding changing the Z-order of a
>>Figure. The response suggested removing the Figure from it's container &
>>readding it to move it to the top of the Z-order. This sounded like a
>>reasonable suggestion to me, and I thought that it would improve the
>>dragging of Figures in my application. I have never really liked having
>>the Figure that I am dragging disappear behind another figure.
>>
>>So I modified the start of dragging to do as suggested to move the
>>Figure to the top of the Z-order. The problem is that when removing the
>>Figure from the container Figure removeNotify() is called which calls
>>requestRemoveFocus() in SWTEventDispatcher. requestRemoveFocus() (among
>>other things) sets mouseTarget to null, and the Figure no longer
>>responds to the MouseMoveEvents. Actually, if I drag outside the border
>>of the Figure, release the mouse button, press the mouse button, and
>>drag back inside the border of the Figure, it reattaches, and I can drag
>>the Figure around. But I don't think that I will be able to train my
>>users to do that. ;-}
>>
>>Anyone know of any work-arounds that will allow me to bring the Figure
>>to the top of the Z-order, and still drag it?
>>
>>TIA,
>>Dave Derry
>>
>
>
>
Re: Changeing Z-order [message #151349 is a reply to message #151109] Fri, 17 September 2004 14:30 Go to previous message
Eclipse UserFriend
Originally posted by: dave.derry.equifax.com

In case anyone might be interested, I did find a solution. I added the
following method into my class that contains the Figure figure:

// move the Figure to the top of the Z-order
public void moveToTop( Point location )
{
panel.remove( figure );
panel.add( figure );
Event event = new Event();
event.x = location.x;
event.y = location.y;
event.button = 1;
event.widget = shell;

figure.internalGetEventDispatcher().dispatchMouseReleased( new
MouseEvent( event ) );
figure.requestFocus();
if( figure instanceof Clickable )
((Clickable)figure).setSelected( true );
figure.internalGetEventDispatcher().dispatchMousePressed( new
MouseEvent( event ) );
}

The shell is the Shell of the window. It isn't used, but the SWT
MouseEvent requires that it not be null. dispatchMouseReleased() resets
the captured flag so that dispatchMousePressed() is able restore the
attributes that were set prior to removing the Figure.

Dave


Dave Derry wrote:
> There was a post a few days ago regarding changing the Z-order of a
> Figure. The response suggested removing the Figure from it's container &
> readding it to move it to the top of the Z-order. This sounded like a
> reasonable suggestion to me, and I thought that it would improve the
> dragging of Figures in my application. I have never really liked having
> the Figure that I am dragging disappear behind another figure.
>
> So I modified the start of dragging to do as suggested to move the
> Figure to the top of the Z-order. The problem is that when removing the
> Figure from the container Figure removeNotify() is called which calls
> requestRemoveFocus() in SWTEventDispatcher. requestRemoveFocus() (among
> other things) sets mouseTarget to null, and the Figure no longer
> responds to the MouseMoveEvents. Actually, if I drag outside the border
> of the Figure, release the mouse button, press the mouse button, and
> drag back inside the border of the Figure, it reattaches, and I can drag
> the Figure around. But I don't think that I will be able to train my
> users to do that. ;-}
>
> Anyone know of any work-arounds that will allow me to bring the Figure
> to the top of the Z-order, and still drag it?
>
> TIA,
> Dave Derry
>
Previous Topic:How do I increase the width of a figure based on text input
Next Topic:GEF 3.0.1 available via downloads page
Goto Forum:
  


Current Time: Sat Apr 27 04:05:17 GMT 2024

Powered by FUDForum. Page generated in 0.03054 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top