Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » DND DND.FEEDBACK_INSERT_BEFORE in TreeTable
DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #373413] Tue, 09 September 2003 23:34 Go to next message
Eclipse UserFriend
Originally posted by: trevor.campbell.baycorpadvantage.com

I have a tree table as a DROP target and was trying to use Feedback styles
of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
seems to be no visible feedback with these styles in Windows or GTK.

DND.FEEDBACK_SELECT works fine but doesn't quite give the correct visible
clues.

Are these implemented at all or do I have to do something special in a
TreeTable.
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #373425 is a reply to message #373413] Wed, 10 September 2003 07:47 Go to previous messageGo to next message
Ralf Koban is currently offline Ralf KobanFriend
Messages: 319
Registered: July 2009
Senior Member
Hi Trevor,

maybe using the underlying Table of a TableTree would help but I don't know.

TableTree.getTable();

Ralf

Trevor schrieb:

> I have a tree table as a DROP target and was trying to use Feedback styles
> of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
> seems to be no visible feedback with these styles in Windows or GTK.
>
> DND.FEEDBACK_SELECT works fine but doesn't quite give the correct visible
> clues.
>
> Are these implemented at all or do I have to do something special in a
> TreeTable.
>
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #373463 is a reply to message #373425] Wed, 10 September 2003 22:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trevor.campbell.baycorpadvantage.com

Thanks Ralph, I managed to find a known bug/issue in bugzilla.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=36822

Ralf Koban wrote:

> Hi Trevor,

> maybe using the underlying Table of a TableTree would help but I don't know.

> TableTree.getTable();

> Ralf

> Trevor schrieb:

> > I have a tree table as a DROP target and was trying to use Feedback styles
> > of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
> > seems to be no visible feedback with these styles in Windows or GTK.
> >
> > DND.FEEDBACK_SELECT works fine but doesn't quite give the correct visible
> > clues.
> >
> > Are these implemented at all or do I have to do something special in a
> > TreeTable.
> >
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #373928 is a reply to message #373413] Sun, 21 September 2003 04:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.10.jgale.spamgourmet.com

I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
markers or something?) betweent he itmes of a Tree/Table/TreeTable but
I've never been able to make these work - it always seems to select the
items instead of indicating before or after. (I've only tried on Windows).

Any feedback on how to make these work would be appreciated.

Trevor wrote:
> I have a tree table as a DROP target and was trying to use Feedback styles
> of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
> seems to be no visible feedback with these styles in Windows or GTK.
>
> DND.FEEDBACK_SELECT works fine but doesn't quite give the correct visible
> clues.
>
> Are these implemented at all or do I have to do something special in a
> TreeTable.
>
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #374008 is a reply to message #373928] Mon, 22 September 2003 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

Jeremy Gale <eclipse.10.jgale@spamgourmet.com> wrote:

I can see black lines for insert before/after in Eclipse 3.0 M3,
but don't see them during drag and drop in Eclipse 2.1.1. However I
can show these lines manually even in 2.1.1.

> I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
> DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
> markers or something?) betweent he itmes of a Tree/Table/TreeTable but
> I've never been able to make these work - it always seems to select the
> items instead of indicating before or after. (I've only tried on Windows).

> Any feedback on how to make these work would be appreciated.

> Trevor wrote:
>> I have a tree table as a DROP target and was trying to use Feedback styles
>> of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
>> seems to be no visible feedback with these styles in Windows or GTK.
>>
>> DND.FEEDBACK_SELECT works fine but doesn't quite give the correct visible
>> clues.
>>
>> Are these implemented at all or do I have to do something special in a
>> TreeTable.
>>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #374090 is a reply to message #373928] Mon, 22 September 2003 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: veronika_irvine.oti.com

InsertBefore/InsertAfter is only implemented for Trees. Please provide a
snippet showing the problem with Trees. The following works for me in 2.1.1
and 3.0:

DropTarget dt = new DropTarget(tree, DND.DROP_COPY | DND.DROP_MOVE);
dt.setTransfer(new Transfer[] {tt});
dt.addDropListener(new DropTargetAdapter() {
public void dragOver(DropTargetEvent event) {
if (event.item != null) {
Rectangle rect = ((TreeItem)event.item).getBounds();
Point pt = tree.toControl(event.x, event.y);
if (pt.y < rect.y + 3) event.feedback =
DND.FEEDBACK_INSERT_BEFORE;
if (pt.y > rect.y + rect.height - 3) event.feedback =
DND.FEEDBACK_INSERT_AFTER;
}
event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
}
});

"Jeremy Gale" <eclipse.10.jgale@spamgourmet.com> wrote in message
news:bkj7ve$vde$1@eclipse.org...
> I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
> DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
> markers or something?) betweent he itmes of a Tree/Table/TreeTable but
> I've never been able to make these work - it always seems to select the
> items instead of indicating before or after. (I've only tried on Windows).
>
> Any feedback on how to make these work would be appreciated.
>
> Trevor wrote:
> > I have a tree table as a DROP target and was trying to use Feedback
styles
> > of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
> > seems to be no visible feedback with these styles in Windows or GTK.
> >
> > DND.FEEDBACK_SELECT works fine but doesn't quite give the correct
visible
> > clues.
> >
> > Are these implemented at all or do I have to do something special in a
> > TreeTable.
> >
>
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #374129 is a reply to message #374090] Mon, 22 September 2003 16:16 Go to previous messageGo to next message
Paul Singleton is currently offline Paul SingletonFriend
Messages: 37
Registered: July 2009
Member
Does a TreeItem's area extend to the right edge of its Tree,
or just to the right edge of its text?

On Windows (XP SP1) and SWT 2.1.1 I get a blue "selected"
feedback if I drag over the blank space beyond an item's
text, but only get the "insert" feedback if I drag over
the text (using snippet below)

Paul Singleton

Veronika Irvine wrote:

> InsertBefore/InsertAfter is only implemented for Trees. Please provide a
> snippet showing the problem with Trees. The following works for me in 2.1.1
> and 3.0:
>
> DropTarget dt = new DropTarget(tree, DND.DROP_COPY | DND.DROP_MOVE);
> dt.setTransfer(new Transfer[] {tt});
> dt.addDropListener(new DropTargetAdapter() {
> public void dragOver(DropTargetEvent event) {
> if (event.item != null) {
> Rectangle rect = ((TreeItem)event.item).getBounds();
> Point pt = tree.toControl(event.x, event.y);
> if (pt.y < rect.y + 3) event.feedback =
> DND.FEEDBACK_INSERT_BEFORE;
> if (pt.y > rect.y + rect.height - 3) event.feedback =
> DND.FEEDBACK_INSERT_AFTER;
> }
> event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
> }
> });
>
> "Jeremy Gale" <eclipse.10.jgale@spamgourmet.com> wrote in message
> news:bkj7ve$vde$1@eclipse.org...
>
>>I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
>>DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
>>markers or something?) betweent he itmes of a Tree/Table/TreeTable but
>>I've never been able to make these work - it always seems to select the
>>items instead of indicating before or after. (I've only tried on Windows).
>>
>>Any feedback on how to make these work would be appreciated.
>>
>>Trevor wrote:
>>
>>>I have a tree table as a DROP target and was trying to use Feedback
>
> styles
>
>>>of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
>>>seems to be no visible feedback with these styles in Windows or GTK.
>>>
>>>DND.FEEDBACK_SELECT works fine but doesn't quite give the correct
>
> visible
>
>>>clues.
>>>
>>>Are these implemented at all or do I have to do something special in a
>>>TreeTable.
>>>
>>
>
>
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #374886 is a reply to message #374129] Fri, 26 September 2003 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: veronika_irvine.oti.com

"getBounds" for a tree item only extends to the edge of the text.

The code for DND.FEEDBACK_SELECT doesn't just use getBounds - it also checks
for the case where you are to the right of the text.


"Paul Singleton" <paul@jbgb.com> wrote in message
news:bkn76o$19j$1@eclipse.org...
> Does a TreeItem's area extend to the right edge of its Tree,
> or just to the right edge of its text?
>
> On Windows (XP SP1) and SWT 2.1.1 I get a blue "selected"
> feedback if I drag over the blank space beyond an item's
> text, but only get the "insert" feedback if I drag over
> the text (using snippet below)
>
> Paul Singleton
>
> Veronika Irvine wrote:
>
> > InsertBefore/InsertAfter is only implemented for Trees. Please provide
a
> > snippet showing the problem with Trees. The following works for me in
2.1.1
> > and 3.0:
> >
> > DropTarget dt = new DropTarget(tree, DND.DROP_COPY | DND.DROP_MOVE);
> > dt.setTransfer(new Transfer[] {tt});
> > dt.addDropListener(new DropTargetAdapter() {
> > public void dragOver(DropTargetEvent event) {
> > if (event.item != null) {
> > Rectangle rect = ((TreeItem)event.item).getBounds();
> > Point pt = tree.toControl(event.x, event.y);
> > if (pt.y < rect.y + 3) event.feedback =
> > DND.FEEDBACK_INSERT_BEFORE;
> > if (pt.y > rect.y + rect.height - 3) event.feedback =
> > DND.FEEDBACK_INSERT_AFTER;
> > }
> > event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
> > }
> > });
> >
> > "Jeremy Gale" <eclipse.10.jgale@spamgourmet.com> wrote in message
> > news:bkj7ve$vde$1@eclipse.org...
> >
> >>I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
> >>DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
> >>markers or something?) betweent he itmes of a Tree/Table/TreeTable but
> >>I've never been able to make these work - it always seems to select the
> >>items instead of indicating before or after. (I've only tried on
Windows).
> >>
> >>Any feedback on how to make these work would be appreciated.
> >>
> >>Trevor wrote:
> >>
> >>>I have a tree table as a DROP target and was trying to use Feedback
> >
> > styles
> >
> >>>of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
> >>>seems to be no visible feedback with these styles in Windows or GTK.
> >>>
> >>>DND.FEEDBACK_SELECT works fine but doesn't quite give the correct
> >
> > visible
> >
> >>>clues.
> >>>
> >>>Are these implemented at all or do I have to do something special in a
> >>>TreeTable.
> >>>
> >>
> >
> >
>
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #374919 is a reply to message #374886] Fri, 26 September 2003 19:09 Go to previous messageGo to next message
Paul Singleton is currently offline Paul SingletonFriend
Messages: 37
Registered: July 2009
Member
Veronika Irvine wrote:

> "getBounds" for a tree item only extends to the edge of the text.

and, at the left, from the edge of the image or text?
and event.item == null for a dragOver beyond either edge,
which is why your snippet shows INSERT feedback only when
over the text.

To get INSERT feedback in step with the default SELECT
feedback, we need to know which TreeItem we *would* be
over if we weren't too far to the right (or left).

The best I can do is this:

public void dragOver(DropTargetEvent event) {
// where are we within the Tree?
Point pt = tree.toControl(event.x, event.y);
// which TreeItem would we be over at (19,Y)?
TreeItem treeItem = tree.getItem(new Point(19, pt.y));
if (treeItem != null) {
// then as before:
Rectangle rect = treeItem.getBounds();
if (pt.y < rect.y + 3){
event.feedback = DND.FEEDBACK_INSERT_BEFORE;
} else if (pt.y > rect.y + rect.height - 3){
event.feedback = DND.FEEDBACK_INSERT_AFTER;
}
}
}

where '19' is an empirical magic number :-) being the x
coord within the Tree where all the TreeItems seem to
start (before that are the boxes with + and - which also
aren't part of the TreeItem apparently).

Is there a more portable & respectable way of doing this?

One final (?) refinement would be to show INSERT_AFTER
feedback when dragging anywhere below the bottommost
TreeItem...

Paul Singleton


> The code for DND.FEEDBACK_SELECT doesn't just use getBounds - it also checks
> for the case where you are to the right of the text.

> "Paul Singleton" <paul@jbgb.com> wrote in message
> news:bkn76o$19j$1@eclipse.org...
>
>>Does a TreeItem's area extend to the right edge of its Tree,
>>or just to the right edge of its text?
>>
>>On Windows (XP SP1) and SWT 2.1.1 I get a blue "selected"
>>feedback if I drag over the blank space beyond an item's
>>text, but only get the "insert" feedback if I drag over
>>the text (using snippet below)
>>
>>Paul Singleton
>>
>>Veronika Irvine wrote:
>>
>>
>>>InsertBefore/InsertAfter is only implemented for Trees. Please provide
>
> a
>
>>>snippet showing the problem with Trees. The following works for me in
>
> 2.1.1
>
>>>and 3.0:
>>>
>>>DropTarget dt = new DropTarget(tree, DND.DROP_COPY | DND.DROP_MOVE);
>>>dt.setTransfer(new Transfer[] {tt});
>>>dt.addDropListener(new DropTargetAdapter() {
>>> public void dragOver(DropTargetEvent event) {
>>> if (event.item != null) {
>>> Rectangle rect = ((TreeItem)event.item).getBounds();
>>> Point pt = tree.toControl(event.x, event.y);
>>> if (pt.y < rect.y + 3) event.feedback =
>>>DND.FEEDBACK_INSERT_BEFORE;
>>> if (pt.y > rect.y + rect.height - 3) event.feedback =
>>>DND.FEEDBACK_INSERT_AFTER;
>>> }
>>> event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
>>> }
>>>});
>>>
>>>"Jeremy Gale" <eclipse.10.jgale@spamgourmet.com> wrote in message
>>>news:bkj7ve$vde$1@eclipse.org...
>>>
>>>
>>>>I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
>>>>DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
>>>>markers or something?) betweent he itmes of a Tree/Table/TreeTable but
>>>>I've never been able to make these work - it always seems to select the
>>>>items instead of indicating before or after. (I've only tried on
>
> Windows).
>
>>>>Any feedback on how to make these work would be appreciated.
>>>>
>>>>Trevor wrote:
>>>>
>>>>
>>>>>I have a tree table as a DROP target and was trying to use Feedback
>>>
>>>styles
>>>
>>>
>>>>>of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
>>>>>seems to be no visible feedback with these styles in Windows or GTK.
>>>>>
>>>>>DND.FEEDBACK_SELECT works fine but doesn't quite give the correct
>>>
>>>visible
>>>
>>>
>>>>>clues.
>>>>>
>>>>>Are these implemented at all or do I have to do something special in a
>>>>>TreeTable.
Re: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable [message #458846 is a reply to message #374090] Fri, 22 July 2005 14:41 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Allow me to extend this snippet. What I have found is that INSERT_BEFORE and
INSERT_AFTER do not mix with SELECT (3.0.2). However, i want to drop ON a
treeitem to make it a leaf of that treeitem. And also drop before or after.
Mind you that the Point and Rectangle thing should not be something that an
application programmer should have to deal with.

What i should really want instead of this block of code is: event.feedback
= DND.FEEDBACK_ALL; // this should work


protected void doDragOver(DropTargetEvent event)
{

/*
* Start with select. Select is not allowed in combination with
* _INSERT_..
*/
event.feedback = DND.FEEDBACK_SELECT;

/*
* From here on Veronika's work:
*
* Calculate if just under or over a TreeItem to activate
..._INSERT_..
* feedbacks.
*/
if (event.item != null)
{
Rectangle rect = ((TreeItem) event.item).getBounds();
Point pt = ((TreeItem) event.item).getParent().toControl(
event.x,
event.y);
if (pt.y < rect.y + 3)
{
event.feedback = DND.FEEDBACK_INSERT_BEFORE; // insert some
debug code if you wish
}
if (pt.y > rect.y + rect.height - 3)
{
event.feedback = DND.FEEDBACK_INSERT_AFTER;
}
}

/*
* OR the found feedback with Expand and Scroll feedbacks.
*/
event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
}


"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:bkmvc9$o56$1@eclipse.org...
> InsertBefore/InsertAfter is only implemented for Trees. Please provide a
> snippet showing the problem with Trees. The following works for me in
> 2.1.1
> and 3.0:
>
> DropTarget dt = new DropTarget(tree, DND.DROP_COPY | DND.DROP_MOVE);
> dt.setTransfer(new Transfer[] {tt});
> dt.addDropListener(new DropTargetAdapter() {
> public void dragOver(DropTargetEvent event) {
> if (event.item != null) {
> Rectangle rect = ((TreeItem)event.item).getBounds();
> Point pt = tree.toControl(event.x, event.y);
> if (pt.y < rect.y + 3) event.feedback =
> DND.FEEDBACK_INSERT_BEFORE;
> if (pt.y > rect.y + rect.height - 3) event.feedback =
> DND.FEEDBACK_INSERT_AFTER;
> }
> event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
> }
> });
>
> "Jeremy Gale" <eclipse.10.jgale@spamgourmet.com> wrote in message
> news:bkj7ve$vde$1@eclipse.org...
>> I'd like to second this. I'm assuming that DND.FEEDBACK_INSERT_BEFORE or
>> DND.FEEDBACK_INSERT_AFTER would insert indications (black horizontal
>> markers or something?) betweent he itmes of a Tree/Table/TreeTable but
>> I've never been able to make these work - it always seems to select the
>> items instead of indicating before or after. (I've only tried on
>> Windows).
>>
>> Any feedback on how to make these work would be appreciated.
>>
>> Trevor wrote:
>> > I have a tree table as a DROP target and was trying to use Feedback
> styles
>> > of DND.FEEDBACK_INSERT_BEFORE and DND.FEEDBACK_INSERT_AFTER, but there
>> > seems to be no visible feedback with these styles in Windows or GTK.
>> >
>> > DND.FEEDBACK_SELECT works fine but doesn't quite give the correct
> visible
>> > clues.
>> >
>> > Are these implemented at all or do I have to do something special in a
>> > TreeTable.
>> >
>>
>
>
Previous Topic:DnD between SWTwidget and oleControl
Next Topic:REVISITED: DND DND.FEEDBACK_INSERT_BEFORE in TreeTable
Goto Forum:
  


Current Time: Wed Oct 28 12:44:51 GMT 2020

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

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

Back to the top