it seems like no more allowed to upload above 100 messages in mailing
list.
so I creates second title. please understand me.
actually I don't understand sizer's index pattern.
but as you said. the index was (0, 1), (2, 3), (4, 5)...
and can I get the index of the selected stc? it seems like there is no
function to get the index of the control in Sizer.
so I made some function to get index. I am not sure whether it is
acceptable.
panel -> stc -> popupmenu
class MyPopupMenu(wx.Menu):
def __init__(self, parent, id):
frmmi = wx.MenuItem(self, wx.NewId(), 'Add control')
self.AppendItem(frmmi)
self.Bind(wx.EVT_MENU, self.OnAddFr, frmmi)
def OnAddFr(self, e):
self.grandparent.GetPosInSizer(self.GetParent().GetId())
class STC(st.StyledTextCtrl):
def __init__(self, *args, **kwargs):
def OnRightDown(self, e):
control = e.GetEventObject()
self.PopupMenu(MyPopupMenu(self.GetParent(), self.GetId()))
class TestPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
def GetPosInSizer(self, control):
chil = self.Autosizer.GetChildren()
for pos in range(len(chil)):
szitem = chil[pos]
if szitem.GetId() == control.GetId():
return pos
def OnAddFortran(self, event):
self.text = wx.StaticText(self, label='F')
self.editor = STC(self)
self.Autosizer.Insert(4, self.text)
self.Autosizer.Insert(5, self.editor, flag=wx.EXPAND)
self.Layout()