Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » HandleBounds and selection of children
HandleBounds and selection of children [message #225529] Tue, 31 October 2006 12:31 Go to next message
Eclipse UserFriend
Originally posted by: ingo.koch[nospam].sap.com

Hi,

i have implemented a container editpart whose figure implements
HandleBounds.
The container editpart has several children (also editparts) which are
located
in the small area between the containers real bounds and the containers
handle bounds.

Now I have the problem that I cannot select these child editparts.

Is there any possibility to workaround this issue?
Modify SelectionTool or drag tracker?

Kind regards,
Ingo
Re: HandleBounds and selection of children [message #225542 is a reply to message #225529] Tue, 31 October 2006 13:17 Go to previous messageGo to next message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
Hi,

I think the easiest way is to override containsPoint() method like so:

public boolean containsPoint(int x, int y)
{
boolean retVal = false;

//See if it is in the main body
retVal = getHandleBounds().contains(x, y);

//Must include all the children
if (!retVal)
{
List children = getChildren();
Iterator childItr = children.iterator();
while (childItr.hasNext())
{
IFigure child = (IFigure) childItr.next();

if (child.containsPoint(x, y))
{
retVal = true;
break;
}
}
}
return retVal;
}

Hope it helps.
Nhu Le


Ingo Koch wrote:
> Hi,
>
> i have implemented a container editpart whose figure implements
> HandleBounds.
> The container editpart has several children (also editparts) which are
> located
> in the small area between the containers real bounds and the containers
> handle bounds.
>
> Now I have the problem that I cannot select these child editparts.
>
> Is there any possibility to workaround this issue?
> Modify SelectionTool or drag tracker?
>
> Kind regards,
> Ingo
>
>
Re: HandleBounds and selection of children [message #225772 is a reply to message #225542] Thu, 02 November 2006 09:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ingo.koch[nospam].sap.com

Ok, thank you but the problem was something else...
I used a transparent border which consumed the clicks....

Thanks,
Ingo


"Nhu Le" <nle.misc@gmail.com> wrote in message
news:ei7id2$mov$1@utils.eclipse.org...
> Hi,
>
> I think the easiest way is to override containsPoint() method like so:
>
> public boolean containsPoint(int x, int y)
> {
> boolean retVal = false;
>
> //See if it is in the main body
> retVal = getHandleBounds().contains(x, y);
>
> //Must include all the children
> if (!retVal)
> {
> List children = getChildren();
> Iterator childItr = children.iterator();
> while (childItr.hasNext())
> {
> IFigure child = (IFigure) childItr.next();
>
> if (child.containsPoint(x, y))
> {
> retVal = true;
> break;
> }
> }
> }
> return retVal;
> }
>
> Hope it helps.
> Nhu Le
>
>
> Ingo Koch wrote:
>> Hi,
>>
>> i have implemented a container editpart whose figure implements
>> HandleBounds.
>> The container editpart has several children (also editparts) which are
>> located
>> in the small area between the containers real bounds and the containers
>> handle bounds.
>>
>> Now I have the problem that I cannot select these child editparts.
>>
>> Is there any possibility to workaround this issue?
>> Modify SelectionTool or drag tracker?
>>
>> Kind regards,
>> Ingo
>>
Re: HandleBounds and selection of children [message #225805 is a reply to message #225772] Thu, 02 November 2006 14:20 Go to previous message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
Since the border is transparent, should it consume the mouse event?. If
it consumes the mouse click then you should be able to select the child
editparts without any problem.

In the implementation I did before, the parent is selected only when you
select within the handlebounds. When you click on a child, only that
child get selected. However, in order for the child the receive the
mouse event in the first place, the parent must indicate the the mouse
click is inside it's boundary (hence the overriden containsPoint()).

Nhu Le

Ingo Koch wrote:
> Ok, thank you but the problem was something else...
> I used a transparent border which consumed the clicks....
>
> Thanks,
> Ingo
>
>
> "Nhu Le" <nle.misc@gmail.com> wrote in message
> news:ei7id2$mov$1@utils.eclipse.org...
>> Hi,
>>
>> I think the easiest way is to override containsPoint() method like so:
>>
>> public boolean containsPoint(int x, int y)
>> {
>> boolean retVal = false;
>>
>> //See if it is in the main body
>> retVal = getHandleBounds().contains(x, y);
>>
>> //Must include all the children
>> if (!retVal)
>> {
>> List children = getChildren();
>> Iterator childItr = children.iterator();
>> while (childItr.hasNext())
>> {
>> IFigure child = (IFigure) childItr.next();
>>
>> if (child.containsPoint(x, y))
>> {
>> retVal = true;
>> break;
>> }
>> }
>> }
>> return retVal;
>> }
>>
>> Hope it helps.
>> Nhu Le
>>
>>
>> Ingo Koch wrote:
>>> Hi,
>>>
>>> i have implemented a container editpart whose figure implements
>>> HandleBounds.
>>> The container editpart has several children (also editparts) which are
>>> located
>>> in the small area between the containers real bounds and the containers
>>> handle bounds.
>>>
>>> Now I have the problem that I cannot select these child editparts.
>>>
>>> Is there any possibility to workaround this issue?
>>> Modify SelectionTool or drag tracker?
>>>
>>> Kind regards,
>>> Ingo
>>>
>
Previous Topic:MultiPage Editor - Problem with delete action across tabs
Next Topic:Overview window Thumbnail.run() infinite loop problem
Goto Forum:
  


Current Time: Sun Nov 28 09:40:00 GMT 2021

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

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

Back to the top