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:
@@ -9,10 +9,10 @@ class MyFrame(wxFrame):
|
||||
wxFrame.__init__(self,None,-1,"Close me...",size=(300,100))
|
||||
menubar = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID,"&Enable output","Display output frame")
|
||||
EVT_MENU(self,mID,output.EnableOutput)
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID,"&Disable output","Close output frame")
|
||||
EVT_MENU(self,mID,output.DisableOutput)
|
||||
menubar.Append(menu,"&Output")
|
||||
@@ -63,10 +63,10 @@ if __name__ == "__main__":
|
||||
## EVT_CLOSE(self,self.OnClose)
|
||||
## menubar = wxMenuBar()
|
||||
## menu = wxMenu()
|
||||
## mID = NewId()
|
||||
## mID = wxNewId()
|
||||
## menu.Append(mID,"&Enable output","Display output frame")
|
||||
## EVT_MENU(self,mID,output.EnableOutput)
|
||||
## mID = NewId()
|
||||
## mID = wxNewId()
|
||||
## menu.Append(mID,"&Disable output","Close output frame")
|
||||
## EVT_MENU(self,mID,output.DisableOutput)
|
||||
## menubar.Append(menu,"&Output")
|
||||
|
@@ -61,7 +61,7 @@ class TestPanel(wxPanel):
|
||||
|
||||
monthlist = GetMonthList()
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.date = wxComboBox(self, mID, "",
|
||||
wxPoint(100, 20), wxSize(90, -1),
|
||||
monthlist, wxCB_DROPDOWN)
|
||||
@@ -89,7 +89,7 @@ class TestPanel(wxPanel):
|
||||
|
||||
# scroll bar for month selection
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.scroll = wxScrollBar(self, mID, wxPoint(100, 240), wxSize(200, 20), wxSB_HORIZONTAL)
|
||||
self.scroll.SetScrollbar(start_month-1, 1, 12, 1, True)
|
||||
EVT_COMMAND_SCROLL(self, mID, self.Scroll)
|
||||
@@ -99,7 +99,7 @@ class TestPanel(wxPanel):
|
||||
self.dtext = wxTextCtrl(self, -1, str(start_year), wxPoint(200, 20), wxSize(60, -1))
|
||||
h = self.dtext.GetSize().height
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.spin = wxSpinButton(self, mID, wxPoint(270, 20), wxSize(h*2, h))
|
||||
self.spin.SetRange(1980, 2010)
|
||||
self.spin.SetValue(start_year)
|
||||
@@ -109,7 +109,7 @@ class TestPanel(wxPanel):
|
||||
|
||||
wxStaticText(self, -1, "Test Calendar Dialog", wxPoint(350, 50), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
bmp = images.getCalendarBitmap()
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 80))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.TestDlg)
|
||||
@@ -118,13 +118,13 @@ class TestPanel(wxPanel):
|
||||
|
||||
wxStaticText(self, -1, "Test Calendar Window", wxPoint(350, 150), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 180))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.TestFrame)
|
||||
|
||||
wxStaticText(self, -1, "Test Calendar Print", wxPoint(350, 250), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 280))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.OnPreview)
|
||||
|
||||
@@ -299,17 +299,17 @@ class CalendFrame(wxFrame):
|
||||
def MakeFileMenu(self):
|
||||
menu = wxMenu()
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID, 'Decrement', 'Next')
|
||||
EVT_MENU(self, mID, self.OnDecMonth)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID, 'Increment', 'Dec')
|
||||
EVT_MENU(self, mID, self.OnIncMonth)
|
||||
|
||||
menu.AppendSeparator()
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID, 'E&xit', 'Exit')
|
||||
EVT_MENU(self, mID, self.OnCloseWindow)
|
||||
|
||||
@@ -318,23 +318,23 @@ class CalendFrame(wxFrame):
|
||||
def MakeToolMenu(self):
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
SetToolPath(self, tb, mID, images.getDbDecBitmap(), 'Dec Year')
|
||||
EVT_TOOL(self, mID, self.OnDecYear)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
SetToolPath(self, tb, mID, images.getDecBitmap(), 'Dec Month')
|
||||
EVT_TOOL(self, mID, self.OnDecMonth)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
SetToolPath(self, tb, mID, images.getPtBitmap(), 'Current Month')
|
||||
EVT_TOOL(self, mID, self.OnCurrent)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
SetToolPath(self, tb, mID, images.getIncBitmap(), 'Inc Month')
|
||||
EVT_TOOL(self, mID, self.OnIncMonth)
|
||||
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
SetToolPath(self, tb, mID, images.getDbIncBitmap(), 'Inc Year')
|
||||
EVT_TOOL(self, mID, self.OnIncYear)
|
||||
|
||||
|
@@ -11,7 +11,7 @@ class TestCheckBox(wxPanel):
|
||||
wxStaticText(self, -1, "This example uses the wxCheckBox control.",
|
||||
wxPoint(10, 10))
|
||||
|
||||
cID = NewId()
|
||||
cID = wxNewId()
|
||||
cb1 = wxCheckBox(self, cID, " Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
|
||||
cb2 = wxCheckBox(self, cID+1, " Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
|
||||
cb2.SetValue(True)
|
||||
|
@@ -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,13 +437,20 @@ 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.
|
||||
"""
|
||||
value = self.GetValue()
|
||||
if value != self.__oldvalue:
|
||||
try:
|
||||
self.GetEventHandler().ProcessEvent(
|
||||
wxIntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
|
||||
@@ -438,6 +458,7 @@ class wxIntCtrl(wxTextCtrl):
|
||||
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