Posted 14 years ago by Michael Maes
Avatar
Hi,

I would like to catch "a" editor_DragDrop - event.
I've seen the "editor_CustomDataObjectText" event, but that doesn't seem to raise for an ordinary string D&D.

My issue is that I need to know the Value of the String so I can insert it on a specific position in the Editor.

I'm new to SyntaxtEditor (so spare me <IMG SRC="smile.gif" border="0"> )

Thanks,

Michael

Comments (10)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

This is something that was requested by another person and we plan on having it implemented for the next major version. It would essentially be the CustomDataObjectText event probably renamed and would always fire, even when only text was dropped.


Actipro Software Support

Posted 14 years ago by Michael Maes
Avatar
Hi,

Would that be 2.6 or 3.0?
When do you expect to release the Major Version?

Kind regards,

Michael
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
3.0 will be the next major version. We have a good start on it (probably half done) but are focused on getting UIStudio out ASAP. Once that is out we'll be jumping back on SyntaxEditor 3.0 development.


Actipro Software Support

Posted 14 years ago by (Anonymous)
Avatar
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Michael Maes:
Hi,

I would like to catch "a" editor_DragDrop - event.
I've seen the "editor_CustomDataObjectText" event, but that doesn't seem to raise for an ordinary string D&D.

My issue is that I need to know the Value of the String so I can insert it on a specific position in the Editor.

I'm new to SyntaxtEditor (so spare me <IMG SRC="smile.gif" border="0"> )

Thanks,

Michael
<HR>


Michael:

I have implemented a drag/drop handler with nothing special. You have to implement the DragOver event handler for the containing form and set e.Effect to something other than DragDropEffects.None and you have to set editor.AllowDrop to true. But otherwise I did nothing special.

Craig
          
private void editor_DragDrop(object sender, DragEventArgs e)
{
    DataItem item = e.Data.GetData( typeof( DataItem ) ) as DataItem;
    if( item == null )
    {
        item = e.Data.GetData( typeof( DoubleDataItem ) ) as DataItem;
    }
    if( item != null )
    {
        Selection selection = editor.SelectedView.Selection;
        if( selection != null && selection.Length == 0 )
        {
            Point p = editor.PointToClient( new Point( e.X, e.Y ) );    
            selection.SelectRange( editor.SelectedView.OffsetFromLocation( p, LocationToOffsetAlgorithm.BestFit ), 0);
        }
                  // set the text in the editor to the item's Path
        editor.SelectedView.SelectedText = item.Path;
        editor.Focus();
    }
}
[ 03-14-2005: Message edited by: Craig Eddy ]
Posted 14 years ago by Michael Maes
Avatar
Hi Craig,

Thanks for your answer.
I fear though that it won't help me much because I need the DragDrop-Event and whatever I try, it doesn't get raised (although the D&D does get executed).
The thing i don't understand at all is that even the CustomDataObjectText-Event is not raised.

This is really a shame, because i want to intercept the "System.String" - Types before they get inserted.

Regards,

Michael
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Michael,

Try making a class that inherits SyntaxEditor and override OnDragDrop with your code.

Like I said, our 3.0 version should address this though.


Actipro Software Support

Posted 14 years ago by Michael Maes
Avatar
OK,

I will do that (most of our components are subclassed anyway).
But like I said: I just started to "Play" with the SyntaxtEditor, so I have to get used to it's architecture.
Great component btw <IMG SRC="smile.gif" border="0">

Look foreward for 3.0!

Thanks,

Michael

(Also thanks for the quick responses!)
Posted 14 years ago by (Anonymous)
Avatar
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Michael Maes:
Hi Craig,

Thanks for your answer.
I fear though that it won't help me much because I need the DragDrop-Event and whatever I try, it doesn't get raised (although the D&D does get executed).
The thing i don't understand at all is that even the CustomDataObjectText-Event is not raised.

This is really a shame, because i want to intercept the "System.String" - Types before they get inserted.

Regards,

Michael
<HR>


Michael: What happens when you drag onto, say Notpad? Are you sure your DRAG code is causing a drag? Are you sure you have AllowDrop set to true for the form and and editor? Are you sure you're implementing a DragOver handler for the form? Honestly, there is nothing special you need to do to implement the drag/drop handler for the editor.
Posted 14 years ago by Michael Maes
Avatar
Hi Craig,

Notepad doesn't implement D&D (I think).
WordPad reacts as suspected.
The Zip contains an Avi which explains my issue.
The D&D-Operation works BUT the D&D-Events don't raise.

As 'support' suggested, I'm going to SubClass the Editor (and hope that solves my issue).

Regards,

Michael
Posted 14 years ago by Michael Maes
Avatar
Oeps... no attachments on this forum <IMG SRC="frown.gif" border="0">
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.