filebrowsebutton changecallback

Help
2010-06-09
2013-05-01
  • Sven Smiles
    Sven Smiles
    2010-06-09

    (actually DirBrowseButton) I set it up in the frame editor but how how I set up changecallback? I edited into the generated code

            self.dirBrowseRoot = wx.lib.filebrowsebutton.DirBrowseButton(buttonText='Browse',
                  dialogTitle='', id=wxID_FRAME1DIRBROWSEROOT, labelText='',
                  newDirectory=False, parent=self.window1, pos=wx.Point(24, 32),
                  size=wx.Size(320, 40), startDirectory='c:\\',
                  style=wx.TAB_TRAVERSAL,
                  toolTip='Type directory name or browse to select',
                  changeCallback = self.dirBrowseRootChangeCallback)
            self.dirBrowseRoot.SetName('dirBrowseRoot')

    and that does what I want but then when I run the frame editor it gives an error
    AttributeError: dirBrowseRootChangeCallback

     
  • You should probably be able to do this:

            self.dirBrowseButton1 = wx.lib.filebrowsebutton.DirBrowseButton(buttonText='Browse',
                  dialogTitle='', id=wxID_DIALOG1DIRBROWSEBUTTON1,
                  labelText='Select a directory:', newDirectory=False, parent=self,
                  pos=wx.Point(40, 16), size=wx.Size(296, 48), startDirectory='.',
                  style=wx.TAB_TRAVERSAL,
                  toolTip='Type directory name or browse to select')

        def __init__(self, parent):
            self._init_ctrls(parent)
           
            self.dirBrowseButton1.changeCallBack = yourCallBack

    It would be nice if FileBrowser would have a setter/getter for this, I believe then Boa could handle this better.  There might also be a way to adapt Boa's Companions\LibCompanions.py but this is stuff I still don't understand well.

    Werner

     
  • Sven Smiles
    Sven Smiles
    2010-06-10

    I tried that, thanks, or to be precise, in my code
       self.dirBrowseRoot.changeCallBack = self.dirBrowseRootChangeCallback
    but the callback isn't called.

    I'll fall back on editing out the line
                  changeCallback = self.dirBrowseRootChangeCallback)
    every time I want to run the frame editor.