wx.StaticBox and siblings creation order, and other fixes from Kevin Ollivier

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-04-25 00:39:05 +00:00
parent 07ec2506d5
commit 0c8f286073
6 changed files with 35 additions and 34 deletions

View File

@@ -18,10 +18,6 @@ class TestWindow(wx.ScrolledWindow):
#self.clrList.sort()
self.bg_bmp = images.getGridBGBitmap()
# Event handlers
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
# This could also be done by getting the window's default font;
# either way, we need to have a font loaded for later on.
#self.SetBackgroundColour("WHITE")
@@ -54,6 +50,11 @@ class TestWindow(wx.ScrolledWindow):
self.SetScrollbars(
self.cellWidth, self.lineHeight, numCells, len(self.clrList) + 2
)
# Event handlers - moved here so events won't fire before init is
# finished.
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
# tile the background bitmap loaded in __init__()

View File

@@ -465,8 +465,8 @@ class wxPythonDemo(wx.Frame):
self.Centre(wx.BOTH)
self.CreateStatusBar(1, wx.ST_SIZEGRIP)
splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN)
splitter2 = wx.SplitterWindow(splitter, -1, style=wx.CLIP_CHILDREN)
splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN | wx.SP_LIVE_UPDATE | wx.SP_3D)
splitter2 = wx.SplitterWindow(splitter, -1, style=wx.CLIP_CHILDREN | wx.SP_LIVE_UPDATE | wx.SP_3D)
# Set up a log on the View Log Notebook page
self.log = wx.TextCtrl(splitter2, -1,

View File

@@ -10,6 +10,13 @@ class TestPanel( wx.Panel ):
self.log = log
panel = wx.Panel( self, -1 )
# Layout controls on panel:
vs = wx.BoxSizer( wx.VERTICAL )
box1_title = wx.StaticBox( panel, -1, "Group 1" )
box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL )
grid1 = wx.FlexGridSizer( 0, 2, 0, 0 )
# 1st group of controls:
self.group1_ctrls = []
radio1 = wx.RadioButton( panel, -1, " Radio1 ", style = wx.RB_GROUP )
@@ -22,25 +29,6 @@ class TestPanel( wx.Panel ):
self.group1_ctrls.append((radio2, text2))
self.group1_ctrls.append((radio3, text3))
# 2nd group of controls:
self.group2_ctrls = []
radio4 = wx.RadioButton( panel, -1, " Radio1 ", style = wx.RB_GROUP )
radio5 = wx.RadioButton( panel, -1, " Radio2 " )
radio6 = wx.RadioButton( panel, -1, " Radio3 " )
text4 = wx.TextCtrl( panel, -1, "" )
text5 = wx.TextCtrl( panel, -1, "" )
text6 = wx.TextCtrl( panel, -1, "" )
self.group2_ctrls.append((radio4, text4))
self.group2_ctrls.append((radio5, text5))
self.group2_ctrls.append((radio6, text6))
# Layout controls on panel:
vs = wx.BoxSizer( wx.VERTICAL )
box1_title = wx.StaticBox( panel, -1, "Group 1" )
box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL )
grid1 = wx.FlexGridSizer( 0, 2, 0, 0 )
for radio, text in self.group1_ctrls:
grid1.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
grid1.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
@@ -52,6 +40,18 @@ class TestPanel( wx.Panel ):
box2 = wx.StaticBoxSizer( box2_title, wx.VERTICAL )
grid2 = wx.FlexGridSizer( 0, 2, 0, 0 )
# 2nd group of controls:
self.group2_ctrls = []
radio4 = wx.RadioButton( panel, -1, " Radio1 ", style = wx.RB_GROUP )
radio5 = wx.RadioButton( panel, -1, " Radio2 " )
radio6 = wx.RadioButton( panel, -1, " Radio3 " )
text4 = wx.TextCtrl( panel, -1, "" )
text5 = wx.TextCtrl( panel, -1, "" )
text6 = wx.TextCtrl( panel, -1, "" )
self.group2_ctrls.append((radio4, text4))
self.group2_ctrls.append((radio5, text5))
self.group2_ctrls.append((radio6, text6))
for radio, text in self.group2_ctrls:
grid2.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
grid2.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )

View File

@@ -26,7 +26,7 @@ class TestPanel(wx.Panel):
text = wx.StaticText(self, -1, str, (20, 100))
font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
text.SetFont(font)
#text.SetSize(text.GetBestSize())
text.SetSize(text.GetBestSize())
wx.StaticText(self, -1, "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line", (20,150))
wx.StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT)

View File

@@ -16,7 +16,9 @@ class TestPanel( scrolled.ScrolledPanel ):
scrolled.ScrolledPanel.__init__( self, parent, -1 )
self.log = log
box_label = wx.StaticBox( self, -1, "Change Controls through API" )
buttonbox = wx.StaticBoxSizer( box_label, wx.HORIZONTAL )
text1 = wx.StaticText( self, -1, "12-hour format:")
self.time12 = masked.TimeCtrl( self, -1, name="12 hour control" )
spin1 = wx.SpinButton( self, -1, wx.DefaultPosition, (-1,20), 0 )
@@ -70,9 +72,7 @@ class TestPanel( scrolled.ScrolledPanel ):
radio_vbox.Add( self.radio24to12, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
radio_vbox.Add( self.radioWx, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
radio_vbox.Add( self.radioMx, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
box_label = wx.StaticBox( self, -1, "Change Controls through API" )
buttonbox = wx.StaticBoxSizer( box_label, wx.HORIZONTAL )
buttonbox.Add( buttonChange, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
buttonbox.Add( radio_vbox, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )

View File

@@ -135,11 +135,11 @@ class ImageDialog(wx.Dialog):
self.dir_x = self.x_pos
self.dir_y = self.y_pos
self.DisplayDir() # display the directory value
self.dir = wx.StaticText(self, -1, self.set_dir, (self.dir_x, self.dir_y), (250, -1))
self.y_pos = self.y_pos + self.delta
btn = wx.Button(self, 12331, ' Set Directory ', (self.x_pos, self.y_pos), size)
btn = wx.Button(self, 12331, ' Set Directory ', (self.x_pos, self.y_pos))
self.Bind(wx.EVT_BUTTON, self.SetDirect, btn)
self.type_posy = self.y_pos # save the y position for the image type combo
@@ -148,7 +148,6 @@ class ImageDialog(wx.Dialog):
self.GetFiles() # get the file list
self.y_pos = self.y_pos + self.delta + 10
self.list_height = 150
# List of Labels
@@ -223,7 +222,8 @@ class ImageDialog(wx.Dialog):
self.fl_list.sort() # sort the file list
def DisplayDir(self): # display the working directory
wx.StaticText(self, -1, self.set_dir, (self.dir_x, self.dir_y), (250, -1))
if self.dir:
self.dir.SetLabel(self.set_dir)
def OnSetType(self, event):
val = event.GetString() # get file type value