TransferDataToWindow / TransferDataFromWindow not called

Python: 2.2.2
wxPython: wxPythonGTK-py2.2-2.4.2.4-1.i386.rpm
wxWindows: 2.4.0 / GTK
Platform: Redhat Linux 9.0 / i386
Compiler: GCC 3.2.2

Hi,

I'm porting a class from C++ to Python. Everything is working fine, but
my TransferDataToWindow / TransferDataFromWindow are not called. What do
I have to do to get these methods called as they are on C++?

Markus

This is the code I use:

class FrameDialog(wxDialog):
    def __init__(self, parent):
        wxDialog.__init__(self, parent, -1, 'Neuen Rahmen erzeugen')
        ... other initialisation ...

    def TransferDataToWindow(self):
        print '********** TRANSFERDATATOWINDOW CALLED **********'

    def TransferDataFromWindow(self):
        print '********** TRANSFERDATAFROMWINDOW CALLED **********'

···

----------------------------------------------------------------------
in the other sourcefile:

        dlg = FrameDialog(self)
        if dlg.ShowModal() == wxID_OK:
             ..... etc ..........

You need to set the extra style

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

for your panel or frame (the "master parent object" holding your controls).

UC

Python: 2.2.2
wxPython: wxPythonGTK-py2.2-2.4.2.4-1.i386.rpm
wxWindows: 2.4.0 / GTK
Platform: Redhat Linux 9.0 / i386
Compiler: GCC 3.2.2

Hi,

I'm porting a class from C++ to Python. Everything is working fine, but
my TransferDataToWindow / TransferDataFromWindow are not called. What do
I have to do to get these methods called as they are on C++?

Markus

This is the code I use:

class FrameDialog(wxDialog):
    def __init__(self, parent):
        wxDialog.__init__(self, parent, -1, 'Neuen Rahmen erzeugen')
        ... other initialisation ...

    def TransferDataToWindow(self):
        print '********** TRANSFERDATATOWINDOW CALLED **********'

    def TransferDataFromWindow(self):
        print '********** TRANSFERDATAFROMWINDOW CALLED **********'

----------------------------------------------------------------------
in the other sourcefile:

        dlg = FrameDialog(self)
        if dlg.ShowModal() == wxID_OK:
             ..... etc ..........

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

- --
  UC

- --
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

···

On Tuesday 23 December 2003 06:22 am, Markus Meyer wrote:

I'd love to report success, but I'm afraid that doesn't work :-/

Infact, I even despairingly tried to set this style for all frames in my
whole application, but with no effect whatsoever.

Markus

···

Am Die, den 23.12.2003 schrieb Uwe C. Schroeder um 18:05:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You need to set the extra style

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

for your panel or frame (the "master parent object" holding your controls).

UC

On Tuesday 23 December 2003 06:22 am, Markus Meyer wrote:
> Python: 2.2.2
> wxPython: wxPythonGTK-py2.2-2.4.2.4-1.i386.rpm
> wxWindows: 2.4.0 / GTK
> Platform: Redhat Linux 9.0 / i386
> Compiler: GCC 3.2.2
>
> Hi,
>
> I'm porting a class from C++ to Python. Everything is working fine, but
> my TransferDataToWindow / TransferDataFromWindow are not called. What do
> I have to do to get these methods called as they are on C++?
>
>
> Markus
>
> This is the code I use:
>
> class FrameDialog(wxDialog):
> def __init__(self, parent):
> wxDialog.__init__(self, parent, -1, 'Neuen Rahmen erzeugen')
> ... other initialisation ...
>
> def TransferDataToWindow(self):
> print '********** TRANSFERDATATOWINDOW CALLED **********'
>
> def TransferDataFromWindow(self):
> print '********** TRANSFERDATAFROMWINDOW CALLED **********'
>
> ----------------------------------------------------------------------
> in the other sourcefile:
>
> dlg = FrameDialog(self)
> if dlg.ShowModal() == wxID_OK:
> ..... etc ..........
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

- --
  UC

- --
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/6HXfjqGXBvRToM4RAoHuAJ4mc+ujN3qA+AhJ3wB4LU8l7wWEbQCgliqA
C7eBdRjOyCzmK6hrg4bszFU=
=HNeL
-----END PGP SIGNATURE-----

Markus Meyer wrote:

Python: 2.2.2
wxPython: wxPythonGTK-py2.2-2.4.2.4-1.i386.rpm
wxWindows: 2.4.0 / GTK
Platform: Redhat Linux 9.0 / i386
Compiler: GCC 3.2.2

Hi,

I'm porting a class from C++ to Python. Everything is working fine, but
my TransferDataToWindow / TransferDataFromWindow are not called. What do
I have to do to get these methods called as they are on C++?

It takes extra work to allow virtual C++ methods to be overridden in Python derived classes. It adds some runtime overhead and a lot of maintainance overhead so I only do it for classes/methods that need it in order to function normally. (IOW, pure virtuals or virtuals that should almost always be overridden.)

What are you wanting to put in the Transfer methods? There is probably another way to do it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I'm using something like the following (which is just because it was
like this in the C++ implementation):

dlg = MyDialog(self)
dlg.AddSpecialOptionToDialog(xyz)
dlg.AddAnotherSpecialOptionToDialog(abc)
dlg.SetSomeValuesInsideTheDialog(pqr)
dlg.ShowModal()

In this example, TransferDataToWindow is called immediately before the
window is shown (inside ShowModal), so I can call additional methods
inbetween the constructor and the call to ShowModal. Likewise, I don't
need to override the OnOK function, because TransferDataFromWindow is
automatically called when OK is pressed.

It's just a very handy mechanism, and I'd have to rewrite my dialogs if
this wouldn't work in wxPython.

Also, the release notes for 2.3.3.1 say that it should work:

http://mail.python.org/pipermail/python-announce-list/2002-September/001700.html

Markus

···

Am Die, den 23.12.2003 schrieb Robin Dunn um 18:29:

> I'm porting a class from C++ to Python. Everything is working fine, but
> my TransferDataToWindow / TransferDataFromWindow are not called. What do
> I have to do to get these methods called as they are on C++?

It takes extra work to allow virtual C++ methods to be overridden in
Python derived classes. It adds some runtime overhead and a lot of
maintainance overhead so I only do it for classes/methods that need it
in order to function normally. (IOW, pure virtuals or virtuals that
should almost always be overridden.)

What are you wanting to put in the Transfer methods? There is probably
another way to do it.

Markus Meyer wrote:

I'm porting a class from C++ to Python. Everything is working fine, but
my TransferDataToWindow / TransferDataFromWindow are not called. What do
I have to do to get these methods called as they are on C++?

It takes extra work to allow virtual C++ methods to be overridden in Python derived classes. It adds some runtime overhead and a lot of maintainance overhead so I only do it for classes/methods that need it in order to function normally. (IOW, pure virtuals or virtuals that should almost always be overridden.)

What are you wanting to put in the Transfer methods? There is probably another way to do it.

I'm using something like the following (which is just because it was
like this in the C++ implementation):

dlg = MyDialog(self)
dlg.AddSpecialOptionToDialog(xyz)
dlg.AddAnotherSpecialOptionToDialog(abc)
dlg.SetSomeValuesInsideTheDialog(pqr)
dlg.ShowModal()

In this example, TransferDataToWindow is called immediately before the
window is shown (inside ShowModal), so I can call additional methods
inbetween the constructor and the call to ShowModal. Likewise, I don't
need to override the OnOK function, because TransferDataFromWindow is
automatically called when OK is pressed.

It's just a very handy mechanism, and I'd have to rewrite my dialogs if
this wouldn't work in wxPython.

Also, the release notes for 2.3.3.1 say that it should work:

ANNOUNCE: wxPython 2.3.3.1

As the release notes say, it is just for wxPyWindow, wxPyPanel and wxPyControl which are custom classes derived from wxWindow, wxPanel, and wxControl and are engineered as described above to allow those methods to be overridden. I suppose I could do the same for a wxPyDialog class, but currently that is not done and so you'll have to workaround it for now anyway. There are probably some events that you can catch that will give you nearly the same functionality. (Try EVT_SHOW.)

···

Am Die, den 23.12.2003 schrieb Robin Dunn um 18:29:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Okay, I'll give EVT_SHOW a try.

Thanks for your help!

Markus

···

Am Die, den 23.12.2003 schrieb Robin Dunn um 19:44:

As the release notes say, it is just for wxPyWindow, wxPyPanel and
wxPyControl which are custom classes derived from wxWindow, wxPanel, and
wxControl and are engineered as described above to allow those methods
to be overridden. I suppose I could do the same for a wxPyDialog class,
but currently that is not done and so you'll have to workaround it for
now anyway. There are probably some events that you can catch that will
give you nearly the same functionality. (Try EVT_SHOW.)

Hi Markus,

Robin Dunn wrote:

Markus Meyer wrote:

I'm porting a class from C++ to Python. Everything is working fine, but
my TransferDataToWindow / TransferDataFromWindow are not called. What do
I have to do to get these methods called as they are on C++?

It takes extra work to allow virtual C++ methods to be overridden in Python derived classes. It adds some runtime overhead and a lot of maintainance overhead so I only do it for classes/methods that need it in order to function normally. (IOW, pure virtuals or virtuals that should almost always be overridden.)

What are you wanting to put in the Transfer methods? There is probably another way to do it.

I'm using something like the following (which is just because it was
like this in the C++ implementation):

dlg = MyDialog(self)
dlg.AddSpecialOptionToDialog(xyz)
dlg.AddAnotherSpecialOptionToDialog(abc)
dlg.SetSomeValuesInsideTheDialog(pqr)
dlg.ShowModal()

In this example, TransferDataToWindow is called immediately before the
window is shown (inside ShowModal), so I can call additional methods
inbetween the constructor and the call to ShowModal. Likewise, I don't
need to override the OnOK function, because TransferDataFromWindow is
automatically called when OK is pressed.

It's just a very handy mechanism, and I'd have to rewrite my dialogs if
this wouldn't work in wxPython.

Also, the release notes for 2.3.3.1 say that it should work:

ANNOUNCE: wxPython 2.3.3.1

As the release notes say, it is just for wxPyWindow, wxPyPanel and wxPyControl which are custom classes derived from wxWindow, wxPanel, and wxControl and are engineered as described above to allow those methods to be overridden. I suppose I could do the same for a wxPyDialog class, but currently that is not done and so you'll have to workaround it for now anyway. There are probably some events that you can catch that will give you nearly the same functionality. (Try EVT_SHOW.)

I am using dialogs with controls which are filled with data from a database through validators. I call in appropriate places of the code self.InitDialog() whenever you need TransferToWindow to be called.

See you
Werner

···

Am Die, den 23.12.2003 schrieb Robin Dunn um 18:29: