wxStyledTextCtrl Drop as target

wxStyledTextCtrl Drop as target

Post by Greg Johanse » Sat, 02 Mar 2002 13:17:27



As per Robin Dunn's suggestion, I am using wxStyleTextCtrl(wxSTC) as the
basis for a "debug window".  Thanks for the pointer and the STC work, Robin.

I'd like to be able to drag/drop non-text objects on the wxSTC to initiate
some action in the wxFrame that is the parent of the wxSTC.  It looks like
the wxSTC may only allow text DnD(not sure on that);  but, in trying to
trace thru the wx DnD related libs, it looks like wxIDropTarget::DragEnter
decides that the format of my drop object is not accepted by the wxSTC, so
the object is released and the result becomes wxDragNone.

    if ( !m_pTarget->IsAcceptedData(pIDataSource) ) {
        // we don't accept this kind of data
        *pdwEffect = DROPEFFECT_NONE;

        return S_OK;
    }

I have used SetDropTarget to define my wxSTC as a valid target for the given
data type, but is there something I can/should do to set the wxSTC to accept
my object as valid drop data?

thanks...gregj

Message: 9


Subject: Re: Any suggestions for a "debug file/source window" control?
Date: Tue, 26 Feb 2002 17:33:47 -0800

Quote:> I'd like to construct something like a file/source window you see in many
> de*s -- a non-editable display of the source file with a column for
> line number and a column for an icon/decoration(like a breakpoint marker).

> Although a text control seems to be a likely base class to start with, I
see
> GTK caveats about the text control counting newline characters -- so be
wary
> of large files.  The 'report' view of a list control would give me the
icon
> and multi-column, but I'd like to be able to select text on a by-word
rather
> than a by-row basis.

> Just wondering if someone has done a similar control and if you might have
> suggestions on what does/does not work well.

Look in the contribs at wxStyledTextCtrl, (contrib/include/wx/stc.h)  It
will do everything you want.  It is a wx wrapper around Scintilla which is
used in many IDEs, de*s and similar applications.

--
Robin Dunn
Software Craftsman

http://www.veryComputer.com/      Relax with wxPython!

 
 
 

1. Making a drop target to handle both File drops and Text Drops

Hi,

I am questing to build a droptarget for a wxListCtrl that can handle
both File and Text drops. Making a droptarget for either one or the
other is very straightforward and is straight out of the sample code,
and works very well in practice.

What is needed to make the same window handle both a files and text
drop. I read thorough the entire documentation of the dnd overviews
and all the classes, and did some trials. I looked through the archive
of questions and didn't seem to find it asked or solved, even though
this seems like something that will probably be needed again.

From the documentation, I know I will be deriving from wxDropTarget
and then associate a wxDataObject with it. I guess the wxDataObject
would need to be a wxDataObjectComposite made up of two
wxDataObjectSimple one for text and one for files, and somewhere along
the line find out whether it was a file or text that was dropped and
get the data. I am guessing that wxTextDataObject and wxFileDataObject
can be just used for the tow wxDataObjectSimple components but am not
sure.

Has this been done before in any existing available wx applications?
If not, any tips to point me in the right direction?

Best wishes,
Robert

2. Software allowing IBM to read Mac disks

3. MyDocs Drop Target

4. changing the search engine

5. Dev Studio as drop target

6. Internet Explorer very very slow.

7. Explorer.exe memory usage

8. Help: Registering Drop Target

9. "Target" menu delays before drop-down

10. Error creating new Target in Target Designer

11. Target Analysis: Easy way to run TAP.EXE without installing XP/2000 on target

12. Merging a target with an existing target.