Bugs item #3060958, was opened at 2010-09-07 07:21
Message generated for change (Tracker Item Submitted) made by 
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=745324&aid=3060958&group_id=140042

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: https://www.google.com/accounts ()
Assigned to: Nobody/Anonymous (nobody)
Summary: Drag and drop requires wxDropSource::DoDragDrop

Initial Comment:
it seems that the DoDragDrop function is required to get drag and drop working

In wxcore_clipddrag.cpp add the following 
// MODIFICATION
static wxLuaArgType s_wxluatypeArray_wxLua_wxDropSource_DoDragDrop[] = { 
&wxluatype_wxDropSource, &wxluatype_TINTEGER, NULL };
static int LUACALL wxLua_wxDropSource_DoDragDrop(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropSource_DoDragDrop[1] = {{ 
wxLua_wxDropSource_DoDragDrop, WXLUAMETHOD_METHOD, 2, 2, 
s_wxluatypeArray_wxLua_wxDropSource_DoDragDrop }};
//     virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly)
static int LUACALL wxLua_wxDropSource_DoDragDrop(lua_State *L)
{
        // wxDragResult effect
        int flags = (int)wxlua_getintegertype(L, 2);
        // get this
        wxDropSource * self = (wxDropSource *)wxluaT_getuserdatatype(L, 1, 
wxluatype_wxDropSource);
        // call GiveFeedback
        wxDragResult result = (self->DoDragDrop(flags));
        // push the result flag
        lua_pushinteger(L, result);

        return 1;
}
// MODIFICATION

and register the function after GiveFeedback for example:
{ "GiveFeedback", WXLUAMETHOD_METHOD, 
s_wxluafunc_wxLua_wxDropSource_GiveFeedback, 1, NULL },

{ "DoDragDrop", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxDropSource_DoDragDrop, 
1, NULL },

in lua, the following can now be used to start a drag and drop operation:
local control = wx.wxListCtrl(parent, wx.wxID_ANY,
                            wx.wxDefaultPosition, wx.wxSize(200, 200),
                            wx.wxLC_ICON)
                            
    control:InsertItem(0, "Cube",0)
    control:InsertItem(1, "Sphere",1)
    control:InsertItem(2, "Cylinder",2)
    control:InsertItem(3, "Rectangle",3)
    
        control:Connect(wx.wxEVT_COMMAND_LIST_BEGIN_DRAG, 
                function(event)
                        local data = wx.wxTextDataObject("This text will be 
dragged.");
                        local dropsource = wx.wxDropSource(data,control)
                        dropsource:DoDragDrop(1)
        end)
   



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=745324&aid=3060958&group_id=140042

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to