Hi,

I do not see these functions in your drawing class, so why are they there? Maybe not the issue but strange.

     EVT_IDLE( MyDrawing::OnIdle )
     EVT_COM_EVENT( MyDrawing::OnComEvent )
     EVT_NEW_CAMELEON( MyDrawing::OnAddCameleon )
     EVT_UNDO( MyDrawing::OnUndoEvent )
     EVT_REDO( MyDrawing::OnRedoEvent )
     EVT_CHANGEDMODIFY_DRAWING( MyDrawing::OnChangeDrawings )

For the rest I see nothing wrong.
How do you set this drawing to the canvas?
If you do not do your extra stuff, is it functioning as before?
Meaning with the normal a2dDrawing, it behaves correctly, if nothing extra done in you drawing class, it should behave the same.

I do not push event handlers, but do connect dynamic events .
So no idea what is causing the error you get.

Regards,

Klaas



On 11/04/2016 06:33 PM, Mike Gibson wrote:

Hello,

I have my own class derived from an a2dDrawing that is giving me some issues that appear to be caused by invalid memory access. I've created my own class so that I can handle some a2dCanvasObject editing events. When an object is edited via mouse on the canvas, I record the changes in a wxPropertyGrid. However, the editing on the canvas can get glitchy (the shape, while being edited can jump around), and I've found that after I'm done editing and return to my program's main UI, that various elements can be affected (such as another unrelated property grid will become uneditable, or I am unable to re-open my canvas editing window).

Any time this issue occurs, when I close my program, I get the following error message TWICE (which does not appear if I do not use the editor):


Here is my a2dDrawing in the header:

class MyDrawing: public a2dDrawing
{
    DECLARE_EVENT_TABLE()
    public:
        MyDrawing(const wxString &name=wxT(""), a2dHabitat *habitat=NULL)
        : a2dDrawing(name, habitat){ m_Owner = NULL; }

        void SetOwner(TDlgPhotoAreas *Owner) { m_Owner = Owner; }

        MyDrawing(const a2dDrawing &other, CloneOptions options, a2dRefMap 
*refs)
            : a2dDrawing(other, options, refs){ m_Owner = NULL; }

        ~MyDrawing(){}

        virtual void OnDoEvent( a2dCommandProcessorEvent &event);

    private:
        TDlgPhotoAreas *m_Owner;
};


and the entire cpp code for the a2dDrawing class:

BEGIN_EVENT_TABLE( MyDrawing, a2dDrawing )
     EVT_IDLE( MyDrawing::OnIdle )
     EVT_COM_EVENT( MyDrawing::OnComEvent )
     EVT_NEW_CAMELEON( MyDrawing::OnAddCameleon )
     EVT_DO( MyDrawing::OnDoEvent )
     EVT_UNDO( MyDrawing::OnUndoEvent )
     EVT_REDO( MyDrawing::OnRedoEvent )
     EVT_CHANGEDMODIFY_DRAWING( MyDrawing::OnChangeDrawings )
END_EVENT_TABLE()


void MyDrawing::OnDoEvent( a2dCommandProcessorEvent &event)
{
    a2dCommand *Command = event.GetCommand();
    const a2dCommandId *ComId = Command->GetCommandId();

    a2dCanvasObject *Obj =
            wxDynamicCast(Command, a2dCommand_AddObject)->GetCanvasObject();

    if ( ComId == &a2dCommand_SetProperty::Id)
    {

        if (Obj)
        {
            a2dRect *Rect = wxDynamicCast(Obj, a2dRect);

            if (m_Owner)
                m_Owner->EditRectangleFromCanvas(Rect);
        }



    }

    if (event.GetCommand()->Modifies())
        Modify(true);

}

Any idea what is causing the issue?


Thanks,

- Mike



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi


_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to