wxValidator.TransferData[To|From]Window Problem

Hi all,
  I'm trying to use validators to move some data between the controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
  Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).
  I tried this code in wxPython 2.4.0.7 in Linux and Windows2k. I'm using
python 2.2.2.

Regards,
  Javier

prueba.py (2.26 KB)

···

--
Q: How many IBM CPU's does it take to execute a job?
A: Four; three to hold it down, and one to rip its head off.

Javier Ruere wrote:

Hi all,
  I'm trying to use validators to move some data between the controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
  Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).

The method names in the validator need to be TransferFromWindow and TransferToWindow (without the "Data")

···

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

Doh! Sorry. :slight_smile:

Javier

Robin Dunn wrote:

Javier Ruere wrote:

Hi all,
    I'm trying to use validators to move some data between the
controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
    Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).

The method names in the validator need to be TransferFromWindow and
TransferToWindow (without the "Data")

- --
Q: How many IBM CPU's does it take to execute a job?

···

A: Four; three to hold it down, and one to rip its head off.

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the SQL data, load some comboboxes and when all data is ready call InitDialog for your panel.

    def loadData(self, pkey):
        """Get the SQL data used by this page and do InitDialog.
        """
        self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
        loadRegionCbList(self, self.regionCB, 'Reload')
        loadSubRegionCbList(self, self.subregionCB, 'Reload')
        self.InitDialog() # needed for "TransferToWindow" in validator when sitting on a panel

If I correctly understand it, InitDialog will call the validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following on my SaveData button.

    def OnSavebutButton(self, event):
        self.Validate()
        self.TransferDataFromWindow()
        self.ds.commit()
Hope this helps, see you
Werner

Javier Ruere wrote:

···

Hi all,
I'm trying to use validators to move some data between the controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).
I tried this code in wxPython 2.4.0.7 in Linux and Windows2k. I'm using
python 2.2.2.

Regards,
Javier

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

from wxPython.wx import *

class MainFrame(wxFrame):
   def __init__(self, parent):
       wxFrame.__init__(self, parent, -1, 'Test')
       Panel(self)

class Panel(wxPanel):
   def __init__(self, parent):
       wxPanel.__init__(self,parent,-1) #,style=wxWS_EX_VALIDATE_RECURSIVELY)
       self.SetAutoLayout(True)

       self.contenedor = [ '' ]
       self.__createWidgets()

   def __createWidgets(self):
       sizer = wxBoxSizer(wxVERTICAL)
       self.SetSizer(sizer)

       self.text = wxTextCtrl(
               self, -1, validator=TransferValidator(self.contenedor, 0))
       self.buttonTo = wxButton(self, -1, "DataToWindow")
       self.buttonFrom = wxButton(self, -1, "DataFromWindow")

       sizer.Add(self.text)
       sizer.Add(self.buttonTo)
       sizer.Add(self.buttonFrom)

       EVT_BUTTON(self.buttonTo, self.buttonTo.GetId(), self.DataToWindow)
       EVT_BUTTON(self.buttonFrom, self.buttonFrom.GetId(),
               self.DataFromWindow)

   def DataToWindow(self, event):
       self.TransferDataToWindow()

   def DataFromWindow(self, event):
       self.TransferDataFromWindow()
       print "Leí:", self.contenedor

class TransferValidator(wxPyValidator):
   def __init__(self, contenedor, index):
       wxPyValidator.__init__(self)
       self.contenedor = contenedor
       self.index = index

   def Clone(self): return TransferValidator(self.contenedor, self.index)

   def Validate(self, win): return True

   def TransferDataFromWindow(self):
       print "TransferValidator: Retrieving data."
       self.container[self.index] = self.GetWindow().GetValue()
       print "TransferValidator: Got '%s'." % self.container[self.index]
       return True

   def TransferDataToWindow(self):
       print "TransferValidator: Cargando '%s'." % self.container[self.index]
       self.GetWindow().SetValue(self.container[self.index])
       return True

class BoaApp(wxApp):
   def OnInit(self):
       wxInitAllImageHandlers()
       self.main = MainFrame(None)
       self.main.Show()
       self.SetTopWindow(self.main)

       return True

def main():
   application = BoaApp(0)
   application.MainLoop()

if __name__ == '__main__':
   main()

I didn't notice that function, will start using it, thanks.
  The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
  Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
  Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

   def loadData(self, pkey):
       """Get the SQL data used by this page and do InitDialog.
       """
       self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
       loadRegionCbList(self, self.regionCB, 'Reload')
       loadSubRegionCbList(self, self.subregionCB, 'Reload')
       self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following on my
SaveData button.

   def OnSavebutButton(self, event):
       self.Validate()
       self.TransferDataFromWindow()
       self.ds.commit()

Hope this helps, see you
Werner

Javier Ruere wrote:

Hi all,
    I'm trying to use validators to move some data between the
controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
    Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).
    I tried this code in wxPython 2.4.0.7 in Linux and Windows2k. I'm
using
python 2.2.2.

Regards,
    Javier

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

[...]

class TransferValidator(wxPyValidator):
   def __init__(self, contenedor, index):
       wxPyValidator.__init__(self)
       self.contenedor = contenedor
       self.index = index

   def Clone(self): return TransferValidator(self.contenedor, self.index)

   def Validate(self, win): return True

   def TransferDataFromWindow(self):
       print "TransferValidator: Retrieving data."
       self.container[self.index] = self.GetWindow().GetValue()
       print "TransferValidator: Got '%s'." % self.container[self.index]
       return True

   def TransferDataToWindow(self):
       print "TransferValidator: Cargando '%s'." %
self.container[self.index]
       self.GetWindow().SetValue(self.container[self.index])
       return True

[...]

- --
Q: How many IBM CPU's does it take to execute a job?

···

A: Four; three to hold it down, and one to rip its head off.

Javier,

Yes, the loading/saving from e.g. a SQL db with validators works great. I am using validators just that, mainly because I am still learning Python etc. and up to now I also got away with using e.g. MaskEdit control to do real data validation.

Great that it helped.

See you
Werner

Javier Ruere wrote:

···

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

I didn't notice that function, will start using it, thanks.
The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

  def loadData(self, pkey):
      """Get the SQL data used by this page and do InitDialog.
      """
      self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
      loadRegionCbList(self, self.regionCB, 'Reload')
      loadSubRegionCbList(self, self.subregionCB, 'Reload')
      self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following on my
SaveData button.

  def OnSavebutButton(self, event):
      self.Validate()
      self.TransferDataFromWindow()
      self.ds.commit()

Hope this helps, see you
Werner

Javier Ruere wrote:

Hi all,
   I'm trying to use validators to move some data between the
controls and
a list but I couldn't so far. If there's anyone who can give me a hand
with this, I would appreciate it.
   Attached I send a small app which shows how I'm trying to do it. The
TransferData* methods from the validator are not been called! I tried to
debug it (with Boa) but got nowhere (I don't use a debugger frecuently).
   I tried this code in wxPython 2.4.0.7 in Linux and Windows2k. I'm
using
python 2.2.2.

Regards,
   Javier

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

[...]

class TransferValidator(wxPyValidator):
  def __init__(self, contenedor, index):
      wxPyValidator.__init__(self)
      self.contenedor = contenedor
      self.index = index

  def Clone(self): return TransferValidator(self.contenedor, self.index)

  def Validate(self, win): return True

  def TransferDataFromWindow(self):
      print "TransferValidator: Retrieving data."
      self.container[self.index] = self.GetWindow().GetValue()
      print "TransferValidator: Got '%s'." % self.container[self.index]
      return True

  def TransferDataToWindow(self):
      print "TransferValidator: Cargando '%s'." %
self.container[self.index]
      self.GetWindow().SetValue(self.container[self.index])
      return True
     

[...]

- --
Q: How many IBM CPU's does it take to execute a job?
A: Four; three to hold it down, and one to rip its head off.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+wtvj8XQC840MeeoRAq93AJ476KrOWq9h30HWmSbVvuuahnenjgCgqWZe
qCfxSUkoCEOELthlSArZOJE=
=Jsj0
-----END PGP SIGNATURE-----

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

After trying out this function, I noticed it doesn't work in my app!
  Like in the example I sent in the OP, I'm using a frame, not a dialog
so I still have to call TransferDataToWindow explicitly.

Regards,
  Javier

Javier Ruere wrote:

  I didn't notice that function, will start using it, thanks.
  The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
  Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
  Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

  def loadData(self, pkey):
      """Get the SQL data used by this page and do InitDialog.
      """
      self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
      loadRegionCbList(self, self.regionCB, 'Reload')
      loadSubRegionCbList(self, self.subregionCB, 'Reload')
      self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following on my
SaveData button.

  def OnSavebutButton(self, event):
      self.Validate()
      self.TransferDataFromWindow()
      self.ds.commit()

Hope this helps, see you
Werner

- --
Q: How many IBM CPU's does it take to execute a job?

···

A: Four; three to hold it down, and one to rip its head off.

Hi Javier,

Took the code you posted some days ago, changed all "container" to "contenador", then used a simple string to SetValue, then call InitDialog when pressing the DataToWindow button and to me it looks like it works.

I get the following output after I close your test program:

TransferValidator: Cargando ''.
TransferValidator: Retrieving data.
TransferValidator: Got 'some text'.
Leí: ['some text']

Changed code is attached.

See you
Werner

Javier Ruere wrote:

prueba.py (2.23 KB)

···

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

After trying out this function, I noticed it doesn't work in my app!
Like in the example I sent in the OP, I'm using a frame, not a dialog
so I still have to call TransferDataToWindow explicitly.

Regards,
Javier

Javier Ruere wrote:

I didn't notice that function, will start using it, thanks.
The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

def loadData(self, pkey):
     """Get the SQL data used by this page and do InitDialog.
     """
     self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
     loadRegionCbList(self, self.regionCB, 'Reload')
     loadSubRegionCbList(self, self.subregionCB, 'Reload')
     self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following on my
SaveData button.

def OnSavebutButton(self, event):
     self.Validate()
     self.TransferDataFromWindow()
     self.ds.commit()

Hope this helps, see you
Werner
     
- --
Q: How many IBM CPU's does it take to execute a job?
A: Four; three to hold it down, and one to rip its head off.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+xaON8XQC840MeeoRAsy2AJ0de+WWn6xEZEHSNds0WIPkDOuBCACfclyi
t/isuNx5617c5ugoKxMr6Q4=
=EFRb
-----END PGP SIGNATURE-----

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

Hi Werner,
  Mmm.... you are right.
  Then should I call TransferDataToWindow or InitDialog? They seem to do
about the same.

Thanks,
  Javier

Werner F. Bruhin wrote:

Hi Javier,

Took the code you posted some days ago, changed all "container" to
"contenador", then used a simple string to SetValue, then call
InitDialog when pressing the DataToWindow button and to me it looks like
it works.

I get the following output after I close your test program:

TransferValidator: Cargando ''.
TransferValidator: Retrieving data.
TransferValidator: Got 'some text'.
Leí: ['some text']

Changed code is attached.

See you
Werner

Javier Ruere wrote:

    After trying out this function, I noticed it doesn't work in my app!
    Like in the example I sent in the OP, I'm using a frame, not a dialog
so I still have to call TransferDataToWindow explicitly.

Regards,
    Javier

Javier Ruere wrote:

    I didn't notice that function, will start using it, thanks.
    The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
    Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
    Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

def loadData(self, pkey):
     """Get the SQL data used by this page and do InitDialog.
     """
     self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
     loadRegionCbList(self, self.regionCB, 'Reload')
     loadSubRegionCbList(self, self.subregionCB, 'Reload')
     self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following
on my
SaveData button.

def OnSavebutButton(self, event):
     self.Validate()
     self.TransferDataFromWindow()
     self.ds.commit()

Hope this helps, see you
Werner

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

from wxPython.wx import *

class MainFrame(wxFrame):
    def __init__(self, parent):
        wxFrame.__init__(self, parent, -1, 'Test')
        Panel(self)

class Panel(wxPanel):
    def __init__(self, parent):
        wxPanel.__init__(self,parent,-1)

#,style=wxWS_EX_VALIDATE_RECURSIVELY)

        self.SetAutoLayout(True)

        self.contenedor = [ '' ]
        self.__createWidgets()

    def __createWidgets(self):
        sizer = wxBoxSizer(wxVERTICAL)
        self.SetSizer(sizer)

        self.text = wxTextCtrl(
                self, -1, validator=TransferValidator(self.contenedor, 0))
        self.buttonTo = wxButton(self, -1, "DataToWindow")
        self.buttonFrom = wxButton(self, -1, "DataFromWindow")

        sizer.Add(self.text)
        sizer.Add(self.buttonTo)
        sizer.Add(self.buttonFrom)

        EVT_BUTTON(self.buttonTo, self.buttonTo.GetId(),

self.DataToWindow)

        EVT_BUTTON(self.buttonFrom, self.buttonFrom.GetId(),
                self.DataFromWindow)

    def DataToWindow(self, event):
        self.InitDialog()

    def DataFromWindow(self, event):
        self.TransferDataFromWindow()
        print "Leí:", self.contenedor

class TransferValidator(wxPyValidator):
    def __init__(self, contenedor, index):
        wxPyValidator.__init__(self)
        self.contenedor = contenedor
        self.index = index

    def Clone(self): return TransferValidator(self.contenedor, self.index)

    def Validate(self, win): return True

    def TransferFromWindow(self):
        print "TransferValidator: Retrieving data."
        self.contenedor[self.index] = self.GetWindow().GetValue()
        print "TransferValidator: Got '%s'." % self.contenedor[self.index]
        return True

    def TransferToWindow(self):
        print "TransferValidator: Cargando '%s'." %

self.contenedor[self.index]

        self.GetWindow().SetValue('some text')
        return True

class BoaApp(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()
        self.main = MainFrame(None)
        self.main.Show()
        self.SetTopWindow(self.main)

        return True

def main():
    application = BoaApp(0)
    application.MainLoop()

if __name__ == '__main__':
    main()

- --
Q: How many IBM CPU's does it take to execute a job?

···

A: Four; three to hold it down, and one to rip its head off.

Javier,

I am quite new to wxPython, Python etc (and would not consider myself too technical either), so I don't know which one is more correct or should be used.

My gut feeling is that it is InitDialog, just because of it's name. As per doc. it only does the transferdata stuff, but maybe it does other things (or will do other things in the future).

Maybe someone else on the list can enlighten us.

See you
Werner

Javier Ruere wrote:

···

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

Hi Werner,
Mmm.... you are right.
Then should I call TransferDataToWindow or InitDialog? They seem to do
about the same.

Thanks,
Javier

Werner F. Bruhin wrote:

Hi Javier,

Took the code you posted some days ago, changed all "container" to
"contenador", then used a simple string to SetValue, then call
InitDialog when pressing the DataToWindow button and to me it looks like
it works.

I get the following output after I close your test program:

TransferValidator: Cargando ''.
TransferValidator: Retrieving data.
TransferValidator: Got 'some text'.
Leí: ['some text']

Changed code is attached.

See you
Werner

Javier Ruere wrote:

   After trying out this function, I noticed it doesn't work in my app!
   Like in the example I sent in the OP, I'm using a frame, not a dialog
so I still have to call TransferDataToWindow explicitly.

Regards,
   Javier

Javier Ruere wrote:

   I didn't notice that function, will start using it, thanks.
   The problem was, as Robin Dunn mentioned, that the method of the
validator were called 'TransferDataFromWindow' instead of
'TransferFromWindow'.
   Anyway, calling 'InitDialog' seems as the Right Thing to do.

Thanks,
   Javier

PS: This is a great way of handling data load/save! I hope I had known
about it before.

Werner F. Bruhin wrote:

Javier,

I needed to include the following to make the validators work.

To get TransferToWindow to work I had to use (InitDialog), e.g. get the
SQL data, load some comboboxes and when all data is ready call
InitDialog for your panel.

def loadData(self, pkey):
    """Get the SQL data used by this page and do InitDialog.
    """
    self.dbItem = self.ds.selectByPrimaryKey(beans.cellarbook, pkey)
    loadRegionCbList(self, self.regionCB, 'Reload')
    loadSubRegionCbList(self, self.subregionCB, 'Reload')
    self.InitDialog() # needed for "TransferToWindow" in validator
when sitting on a panel

If I correctly understand it, InitDialog will call the
validator.TransferToWindow function of each control on the panel.

And to get TransferFromWindow to work I needed to do the following
on my
SaveData button.

def OnSavebutButton(self, event):
    self.Validate()
    self.TransferDataFromWindow()
    self.ds.commit()

Hope this helps, see you
Werner
         

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

from wxPython.wx import *

class MainFrame(wxFrame):
   def __init__(self, parent):
       wxFrame.__init__(self, parent, -1, 'Test')
       Panel(self)

class Panel(wxPanel):
   def __init__(self, parent):
       wxPanel.__init__(self,parent,-1)
   

#,style=wxWS_EX_VALIDATE_RECURSIVELY)

       self.SetAutoLayout(True)

       self.contenedor = [ '' ]
       self.__createWidgets()

   def __createWidgets(self):
       sizer = wxBoxSizer(wxVERTICAL)
       self.SetSizer(sizer)

       self.text = wxTextCtrl(
               self, -1, validator=TransferValidator(self.contenedor, 0))
       self.buttonTo = wxButton(self, -1, "DataToWindow")
       self.buttonFrom = wxButton(self, -1, "DataFromWindow")

       sizer.Add(self.text)
       sizer.Add(self.buttonTo)
       sizer.Add(self.buttonFrom)

       EVT_BUTTON(self.buttonTo, self.buttonTo.GetId(),
   

self.DataToWindow)

       EVT_BUTTON(self.buttonFrom, self.buttonFrom.GetId(),
               self.DataFromWindow)

   def DataToWindow(self, event):
       self.InitDialog()

   def DataFromWindow(self, event):
       self.TransferDataFromWindow()
       print "Leí:", self.contenedor

class TransferValidator(wxPyValidator):
   def __init__(self, contenedor, index):
       wxPyValidator.__init__(self)
       self.contenedor = contenedor
       self.index = index

   def Clone(self): return TransferValidator(self.contenedor, self.index)

   def Validate(self, win): return True

   def TransferFromWindow(self):
       print "TransferValidator: Retrieving data."
       self.contenedor[self.index] = self.GetWindow().GetValue()
       print "TransferValidator: Got '%s'." % self.contenedor[self.index]
       return True

   def TransferToWindow(self):
       print "TransferValidator: Cargando '%s'." %
   

self.contenedor[self.index]

       self.GetWindow().SetValue('some text')
       return True

class BoaApp(wxApp):
   def OnInit(self):
       wxInitAllImageHandlers()
       self.main = MainFrame(None)
       self.main.Show()
       self.SetTopWindow(self.main)

       return True

def main():
   application = BoaApp(0)
   application.MainLoop()

if __name__ == '__main__':
   main()
   
- --
Q: How many IBM CPU's does it take to execute a job?
A: Four; three to hold it down, and one to rip its head off.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+yORI8XQC840MeeoRAgB4AKCBHZCYx38I/eTaBx5a5zF26tgS+QCgsjjs
uguoZ5s96WLwVOrLKELP8wU=
=Cm+Y
-----END PGP SIGNATURE-----

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

Werner F. Bruhin wrote:

Javier,

I am quite new to wxPython, Python etc (and would not consider myself too technical either), so I don't know which one is more correct or should be used.

My gut feeling is that it is InitDialog, just because of it's name. As per doc. it only does the transferdata stuff, but maybe it does other things (or will do other things in the future).

Maybe someone else on the list can enlighten us.

InitDialog sends a wxInitDialogEvent to the window. The default handler for that event just calls TransferDataToWindow().

···

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

Werner,
  Robin Dunn already replied saying that InitDialog sends an event. I had
seen this in the docs but since I don't think I'll be needing the event
I wondered if there was a sugested way of doing this.
  Currently I'm calling TransferDataToWindow directly but will keep in
mind InitDialog in case I need to perform some other action when loading
data.

See you,
  Javier

Werner F. Bruhin wrote:

Javier,

I am quite new to wxPython, Python etc (and would not consider myself
too technical either), so I don't know which one is more correct or
should be used.

My gut feeling is that it is InitDialog, just because of it's name. As
per doc. it only does the transferdata stuff, but maybe it does other
things (or will do other things in the future).

Maybe someone else on the list can enlighten us.

See you
Werner

Javier Ruere wrote:

Hi Werner,
    Mmm.... you are right.
    Then should I call TransferDataToWindow or InitDialog? They seem
to do
about the same.

Thanks,
    Javier

- --
Q: How many IBM CPU's does it take to execute a job?

···

A: Four; three to hold it down, and one to rip its head off.