Some NewId() --> wxNewId() changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -716,12 +716,12 @@ class CalenDlg(wxDialog):
|
||||
monthlist = GetMonthList()
|
||||
|
||||
# select the month
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.date = wxComboBox(self, mID, Month[start_month], wxPoint(20, 20), wxSize(90, -1), monthlist, wxCB_DROPDOWN)
|
||||
EVT_COMBOBOX(self, mID, self.EvtComboBox)
|
||||
|
||||
# alternate spin button to control the month
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
h = self.date.GetSize().height
|
||||
self.m_spin = wxSpinButton(self, mID, wxPoint(130, 20), wxSize(h*2, h), wxSP_VERTICAL)
|
||||
self.m_spin.SetRange(1, 12)
|
||||
@@ -730,7 +730,7 @@ class CalenDlg(wxDialog):
|
||||
EVT_SPIN(self, mID, self.OnMonthSpin)
|
||||
|
||||
# spin button to control the year
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.dtext = wxTextCtrl(self, -1, str(start_year), wxPoint(160, 20), wxSize(60, -1))
|
||||
h = self.dtext.GetSize().height
|
||||
|
||||
@@ -746,11 +746,11 @@ class CalenDlg(wxDialog):
|
||||
y_pos = 280
|
||||
but_size = wxSize(60, 25)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
wxButton(self, mID, ' Ok ', wxPoint(x_pos, y_pos), but_size)
|
||||
EVT_BUTTON(self, mID, self.OnOk)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
wxButton(self, mID, ' Close ', wxPoint(x_pos + 120, y_pos), but_size)
|
||||
EVT_BUTTON(self, mID, self.OnCancel)
|
||||
|
||||
|
@@ -130,12 +130,12 @@ class _MyStatusBar(wxStatusBar):
|
||||
|
||||
self.SetStatusText("",0)
|
||||
|
||||
ID = NewId()
|
||||
ID = wxNewId()
|
||||
self.button1 = wxButton(self,ID,"Dismiss",
|
||||
style=wxTAB_TRAVERSAL)
|
||||
EVT_BUTTON(self,ID,self.OnButton1)
|
||||
|
||||
ID = NewId()
|
||||
ID = wxNewId()
|
||||
if not useopenbutton:
|
||||
self.button2 = wxButton(self,ID,"Close File",
|
||||
style=wxTAB_TRAVERSAL)
|
||||
|
@@ -338,17 +338,18 @@ class wxIntCtrl(wxTextCtrl):
|
||||
wxIntCtrl(
|
||||
parent, id = -1,
|
||||
value = 0,
|
||||
pos = wxDefaultPosition,
|
||||
size = wxDefaultSize,
|
||||
style = 0,
|
||||
validator = wxDefaultValidator,
|
||||
name = "integer",
|
||||
min = None,
|
||||
max = None,
|
||||
limited = False,
|
||||
allow_none = False,
|
||||
allow_long = False,
|
||||
default_color = wxBLACK,
|
||||
oob_color = wxRED,
|
||||
pos = wxDefaultPosition,
|
||||
size = wxDefaultSize,
|
||||
style = 0,
|
||||
name = "integer")
|
||||
oob_color = wxRED )
|
||||
|
||||
value
|
||||
If no initial value is set, the default will be zero, or
|
||||
@@ -390,14 +391,22 @@ class wxIntCtrl(wxTextCtrl):
|
||||
oob_color
|
||||
Color value used for out-of-bounds values of the control
|
||||
when the bounds are set but the control is not limited.
|
||||
|
||||
validator
|
||||
Normally None, wxIntCtrl uses its own validator to do value
|
||||
validation and input control. However, a validator derived
|
||||
from wxIntValidator can be supplied to override the data
|
||||
transfer methods for the wxIntValidator class.
|
||||
"""
|
||||
|
||||
def __init__ (
|
||||
self, parent, id=-1,
|
||||
pos = wxDefaultPosition, size = wxDefaultSize,
|
||||
style = 0, validator = wxDefaultValidator,
|
||||
name = "integer",
|
||||
value = 0, min=None, max=None,
|
||||
limited = 0, allow_none = 0, allow_long = 0,
|
||||
default_color = wxBLACK, oob_color = wxRED,
|
||||
pos = wxDefaultPosition, size = wxDefaultSize,
|
||||
style = 0, name = "integer",
|
||||
):
|
||||
|
||||
# Establish attrs required for any operation on value:
|
||||
@@ -408,10 +417,14 @@ class wxIntCtrl(wxTextCtrl):
|
||||
self.__oob_color = wxRED
|
||||
self.__allow_none = 0
|
||||
self.__allow_long = 0
|
||||
self.__oldvalue = None
|
||||
|
||||
if validator == wxDefaultValidator:
|
||||
validator = wxIntValidator()
|
||||
|
||||
wxTextCtrl.__init__(
|
||||
self, parent, id, self._toGUI(0),
|
||||
pos, size, style, wxIntValidator(), name )
|
||||
pos, size, style, validator, name )
|
||||
|
||||
# The following lets us set out our "integer update" events:
|
||||
EVT_TEXT( self, self.GetId(), self.OnText )
|
||||
@@ -424,20 +437,28 @@ class wxIntCtrl(wxTextCtrl):
|
||||
self.SetNoneAllowed(allow_none)
|
||||
self.SetLongAllowed(allow_long)
|
||||
self.SetValue(value)
|
||||
self.__oldvalue = 0
|
||||
|
||||
|
||||
def OnText( self, event ):
|
||||
"""
|
||||
Handles an event indicating that the text control's value
|
||||
has changed, and issue EVT_INT event.
|
||||
NOTE: using wxTextCtrl.SetValue() to change the control's
|
||||
contents from within a EVT_CHAR handler can cause double
|
||||
text events. So we check for actual changes to the text
|
||||
before passing the events on.
|
||||
"""
|
||||
try:
|
||||
self.GetEventHandler().ProcessEvent(
|
||||
wxIntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
||||
except ValueError:
|
||||
return
|
||||
# let normal processing of the text continue
|
||||
event.Skip()
|
||||
value = self.GetValue()
|
||||
if value != self.__oldvalue:
|
||||
try:
|
||||
self.GetEventHandler().ProcessEvent(
|
||||
wxIntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
||||
except ValueError:
|
||||
return
|
||||
# let normal processing of the text continue
|
||||
event.Skip()
|
||||
self.__oldvalue = value # record for next event
|
||||
|
||||
|
||||
def GetValue(self):
|
||||
@@ -719,6 +740,13 @@ class wxIntCtrl(wxTextCtrl):
|
||||
"""
|
||||
Conversion function used in getting the value of the control.
|
||||
"""
|
||||
|
||||
# One or more of the underlying text control implementations
|
||||
# issue an intermediate EVT_TEXT when replacing the control's
|
||||
# value, where the intermediate value is an empty string.
|
||||
# So, to ensure consistency and to prevent spurious ValueErrors,
|
||||
# we make the following test, and react accordingly:
|
||||
#
|
||||
if value == '':
|
||||
if not self.IsNoneAllowed():
|
||||
return 0
|
||||
@@ -811,7 +839,7 @@ if __name__ == '__main__':
|
||||
style = wxDEFAULT_DIALOG_STYLE ):
|
||||
wxDialog.__init__(self, parent, id, title, pos, size, style)
|
||||
|
||||
self.int_ctrl = wxIntCtrl(self, NewId(), size=(55,20))
|
||||
self.int_ctrl = wxIntCtrl(self, wxNewId(), size=(55,20))
|
||||
self.OK = wxButton( self, wxID_OK, "OK")
|
||||
self.Cancel = wxButton( self, wxID_CANCEL, "Cancel")
|
||||
|
||||
|
Reference in New Issue
Block a user