Problem with SetValidator

Appology in advance for reposting it - but I got some new info.

I am trying to use SetValidator but can't get it to work. Saw the message exchange about SetExtraStyle and tried it but it does NOT make things work for me, at least not the way I would like to.

I am on Win XP Professional, Python 2.3, wxPython 2.4.1.2

I have a wxFrame, with a wxSplitterWindow, with a Panel containing a ListCtrl.

This works (code snippets), i.e. it loads the listctrl with the rows from the database:
       self.cellarBook = ListCtrlPanel(id=wxID_MWCBFCELLARBOOK,
             name='cellarBook', parent=self.splitterWindow, pos=wxPoint(2, 2),
             size=wxSize(1012, 0), style=wxTAB_TRAVERSAL,
             validator=validators.valLC(dbParent = self,
                                           dbRel = 'TABLE'))
       self.cellarBook.InitDialog()

This does NOT work:
       self.cellarBook = ListCtrlPanel(id=wxID_MWCBFCELLARBOOK,
             name='cellarBook', parent=self.splitterWindow, pos=wxPoint(2, 2),
             size=wxSize(1012, 0), style=wxTAB_TRAVERSAL)

       self.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
       self.splitterWindow.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
       self.cellarBook.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
       self.cellarBook.list.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)

       self.cellarBook.SetValidator(validators.valLC(dbParent = self,
                                           dbRel = 'TABLE'))

       self.cellarBook.InitDialog()

However replacing in the above self.cellarBook.InitDialog() with self.InitDialog() it works. BUT this is not quit what I want as in some cases I ONLY want to load the data into the cellarBook panel and NOT all the other panels sitting on the frame (self) as their data has NOT changed.

Best regards
Werner

I figured it out what I did wrong, did the SetValidator on the wrong object?! Dummy me.

If I change:
      self.cellarBook.SetValidator(validators.valLC(dbParent = self, dbRel = 'TABLE'))

to:
      self.cellarBook.list.SetValidator(validators.valLC(dbParent = self, dbRel = 'TABLE'))

Then it all works as I would like to, and I DO NOT need SetExtraStyle either.

See you
Werner

Werner F. Bruhin wrote:

···

Appology in advance for reposting it - but I got some new info.

I am trying to use SetValidator but can't get it to work. Saw the message exchange about SetExtraStyle and tried it but it does NOT make things work for me, at least not the way I would like to.

I am on Win XP Professional, Python 2.3, wxPython 2.4.1.2

I have a wxFrame, with a wxSplitterWindow, with a Panel containing a ListCtrl.

This works (code snippets), i.e. it loads the listctrl with the rows from the database:
      self.cellarBook = ListCtrlPanel(id=wxID_MWCBFCELLARBOOK,
            name='cellarBook', parent=self.splitterWindow, pos=wxPoint(2, 2),
            size=wxSize(1012, 0), style=wxTAB_TRAVERSAL,
            validator=validators.valLC(dbParent = self,
                                          dbRel = 'TABLE'))
      self.cellarBook.InitDialog()

This does NOT work:
      self.cellarBook = ListCtrlPanel(id=wxID_MWCBFCELLARBOOK,
            name='cellarBook', parent=self.splitterWindow, pos=wxPoint(2, 2),
            size=wxSize(1012, 0), style=wxTAB_TRAVERSAL)

      self.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
      self.splitterWindow.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
      self.cellarBook.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)
      self.cellarBook.list.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY)

      self.cellarBook.SetValidator(validators.valLC(dbParent = self,
                                          dbRel = 'TABLE'))

      self.cellarBook.InitDialog()

However replacing in the above self.cellarBook.InitDialog() with self.InitDialog() it works. BUT this is not quit what I want as in some cases I ONLY want to load the data into the cellarBook panel and NOT all the other panels sitting on the frame (self) as their data has NOT changed.

Best regards
Werner

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