a fix for the last fix

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-03-26 22:15:33 +00:00
parent 19cf4f8086
commit c1e820a40e

View File

@@ -81,6 +81,7 @@ class FileBrowseButton(wxPanel):
# SetValue is used to disable the callback # SetValue is used to disable the callback
self.SetValue( initialValue, 0) self.SetValue( initialValue, 0)
def createDialog( self, parent, id, pos, size, style ): def createDialog( self, parent, id, pos, size, style ):
"""Setup the graphic representation of the dialog""" """Setup the graphic representation of the dialog"""
wxPanel.__init__ (self, parent, id, pos, size, style) wxPanel.__init__ (self, parent, id, pos, size, style)
@@ -134,7 +135,7 @@ class FileBrowseButton(wxPanel):
return textControl return textControl
def OnChanged(self, evt): def OnChanged(self, evt):
if self.callCallback: if self.callCallback and self.changeCallback:
self.changeCallback(evt) self.changeCallback(evt)
def createBrowseButton( self): def createBrowseButton( self):
@@ -161,14 +162,13 @@ class FileBrowseButton(wxPanel):
dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode) dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode)
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
self.SetValue (dlg.GetPath()) self.SetValue(dlg.GetPath())
dlg.Destroy() dlg.Destroy()
def GetValue (self): def GetValue (self):
""" Convenient access to text control value """ """ Convenient access to text control value """
return self.textControl.GetValue () return self.textControl.GetValue()
def SetValue (self, value, callBack=1): def SetValue (self, value, callBack=1):
""" Convenient setting of text control value """ """ Convenient setting of text control value """
@@ -196,6 +196,7 @@ class FileBrowseButton(wxPanel):
class FileBrowseButtonWithHistory( FileBrowseButton ): class FileBrowseButtonWithHistory( FileBrowseButton ):
""" with following additions: """ with following additions:
__init__(..., history=None) __init__(..., history=None)
@@ -230,6 +231,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
self.history=None self.history=None
apply( FileBrowseButton.__init__, ( self,)+arguments, namedarguments) apply( FileBrowseButton.__init__, ( self,)+arguments, namedarguments)
def createTextControl( self): def createTextControl( self):
"""Create the text control""" """Create the text control"""
ID = wxNewId() ID = wxNewId()
@@ -245,6 +247,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
self.SetHistory( history, control=textControl) self.SetHistory( history, control=textControl)
return textControl return textControl
def GetHistoryControl( self ): def GetHistoryControl( self ):
"""Return a pointer to the control which provides (at least) """Return a pointer to the control which provides (at least)
the following methods for manipulating the history list.: the following methods for manipulating the history list.:
@@ -256,6 +259,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
""" """
return self.textControl return self.textControl
def SetHistory( self, value=(), selectionIndex = None, control=None ): def SetHistory( self, value=(), selectionIndex = None, control=None ):
"""Set the current history list""" """Set the current history list"""
if control is None: if control is None:
@@ -274,6 +278,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
if selectionIndex is not None: if selectionIndex is not None:
control.SetSelection( selectionIndex ) control.SetSelection( selectionIndex )
def GetHistory( self ): def GetHistory( self ):
"""Return the current history list""" """Return the current history list"""
if self.historyCallBack != None: if self.historyCallBack != None:
@@ -281,12 +286,14 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
else: else:
return list( self.history ) return list( self.history )
def OnSetFocus(self, event): def OnSetFocus(self, event):
"""When the history scroll is selected, update the history""" """When the history scroll is selected, update the history"""
if self.historyCallBack != None: if self.historyCallBack != None:
self.SetHistory( self.historyCallBack(), control=self.textControl) self.SetHistory( self.historyCallBack(), control=self.textControl)
event.Skip() event.Skip()
if wxPlatform == "__WXMSW__": if wxPlatform == "__WXMSW__":
def SetValue (self, value, callBack=1): def SetValue (self, value, callBack=1):
""" Convenient setting of text control value, works """ Convenient setting of text control value, works