Fixed default size of wxTimeCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-09-19 05:52:24 +00:00
parent 6056c203bd
commit 197daf705d

View File

@@ -68,15 +68,18 @@ class wxTimeCtrl(wxTextCtrl):
spinButton = None,
style = wxTE_PROCESS_TAB, name = "time"
):
self.__fmt24hr = fmt24hr
if size == wxDefaultSize:
# set appropriate default sizes depending on format:
if self.__fmt24hr: size = wxSize(52, -1)
else: size = wxSize(70, -1)
wxTextCtrl.__init__(self, parent, id, value='',
pos=pos, size=size, style=style, name=name)
self.__fmt24hr = fmt24hr
if size == wxDefaultSize:
# set appropriate default sizes depending on format:
if self.__fmt24hr:
testText = '00:00:00 '
else:
testText = '00:00:00 XXX'
w, h = self.GetTextExtent(testText)
self.SetClientSize( (w+4, -1) )
# Set up all the positions of the cells in the wxTimeCtrl (once):
# Format of control is:
@@ -634,8 +637,13 @@ class wxTimeCtrl(wxTextCtrl):
self.SetValue(newtext)
self.SetInsertionPoint(pos+1)
#----------------------------------------------------------------------------
class TestPanel(wxPanel):
if __name__ == '__main__':
import traceback
class TestPanel(wxPanel):
def __init__(self, parent, id,
pos = wxPyDefaultPosition, size = wxPyDefaultSize,
fmt24hr = 0, test_mx = 0,
@@ -667,19 +675,11 @@ class TestPanel(wxPanel):
_dbg('mxdt =', mxdt.hour, mxdt.minute, mxdt.second)
#----------------------------------------------------------------------------
if __name__ == '__main__':
import traceback
class MyApp(wxApp):
def OnInit(self):
import sys
fmt24hr = '24' in sys.argv
test_mx = 'mx' in sys.argv
try:
frame = wxFrame(NULL, -1, "Junk", wxPoint(20,20), wxSize(100,100) )
panel = TestPanel(frame, -1, wxPoint(-1,-1), fmt24hr=fmt24hr, test_mx = test_mx)
@@ -687,7 +687,6 @@ if __name__ == '__main__':
except:
traceback.print_exc()
return false
return true
try: