Re: Another wx behavior question

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: John McCawley <jmccawley(at)worleyco(dot)com>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Another wx behavior question
Date: 2003-12-08 23:01:39
Message-ID: 3FD502D3.4070003@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

John McCawley wrote:

> I have done a ton of work on pgDesigner, and I'm almost ready for a
> 1.0 release. I decided to compile a Windows binary, but I am getting
> the following compile error when compiling under MSVC 6 (Note: it
> compiles and runs fine under Linux)
>
> error C2440: 'type case' : cannot convert from 'void
> (__thiscall_CDiagramWindow::*)(void)' to 'void (__thiscall
> wxEvtHandler::*)(class wxCommandEvent &)'
>
> I only get this on EVT_PAINT and EVT_MENU events, but not in all
> classes, just two of them. Is there something flakey regarding MSVC
> and event handlers? All of my handlers are pretty vanilla. The only
> thing I can see is that one of the classes that isn't working uses
> multiple inheritance. However, the other one doesn't, and it still
> isn't working.
>
> Below is one of the ones that isn't working:
>
> class CDiagramWindow : public wxScrolledWindow {
> public:
> /* stuff */
> private:
> DECLARE_DYNAMIC_CLASS(CDiagramWindow)
> DECLARE_EVENT_TABLE()
> };
>
> IMPLEMENT_DYNAMIC_CLASS(CDiagramWindow, wxScrolledWindow)
>
> BEGIN_EVENT_TABLE(CDiagramWindow, wxScrolledWindow)
> EVT_CHAR(CDiagramWindow::OnChar)
> EVT_RIGHT_UP(CDiagramWindow::OnRightClick)
> EVT_LEFT_DOWN(CDiagramWindow::OnLeftDown)
> EVT_MENU(ID_NEW_TABLE, CDiagramWindow::OnNewTable)
> EVT_MENU(ID_SELECT_COLOR, CDiagramWindow::OnSelectColor)
> EVT_MENU(ID_DELETE_KEY, CDiagramWindow::OnDeleteKey)
> EVT_PAINT(CDiagramWindow::OnPaint)
> EVT_MOTION(CDiagramWindow::OnMotion)
> END_EVENT_TABLE()

John, you really should post stuff like this on the wx lists....

Still, I have some suggestions to you.
First: It appears to me that you're defining event handler methods that
don't have an event& argument. This will lead to a major desaster if you
use another compiler. This might already cover your problem as well.
Second: If registering event handlers outside the event table, you will
need some casting, sometimes even multiple casts.

Regards,
Andreas

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Jean-Michel POURE 2003-12-09 09:27:17 Re: pgAdmin3 tl_PH translation (Partial)
Previous Message John McCawley 2003-12-08 20:25:56 Another wx behavior question