Guenther Fischer schrieb:
Hi,
I use wxListCtrl(self.split, ID_L,
style=wxLC_REPORT|wxSUNKEN_BORDER|wxLC_HRULES)
to create a list in a splitted window. The functionality of the list is
great. I have some colums with different width per line. I didn't find how
to set the multicolumn feature described in the docs:
wxLC_REPORT single or multicolumn report view, with optional header.
see example.
The information of a line should fit on the window without scrolling.
surely horizontal ?
breaking into pieces (list of texts) and add it as a new line
in the desired columns (see example)?
See also demo/wxGrid/Editors and Renderers (GridStdEdRend.py), there's
longer one-line text visible as multiline.
example from me, but the list is the a child of a notebook not of
(MSW98/Python2.0/wxPython2.2):
self.event_list= wxListCtrl(parent, self.event_listid,
size=parent.GetClientSize(),
style=wxLC_REPORT|wxSUNKEN_BORDER|wxWANTS_CHARS)
...
for i in xrange(0, cnt_col):
if col_align[i] == 'l':
self.event_list.InsertColumn(i, col_h[i], wxLIST_FORMAT_LEFT)
else:
self.event_list.InsertColumn(i, col_h[i], wxLIST_FORMAT_RIGHT)
#inserting rows
row_ix= 0
for i in xrange(0, len(self.evnt_txt_list)):
evnt_t= self.evnt_txt_list[i][1]
self.event_list.InsertStringItem(row_ix, evnt_t[0])
self.event_list.SetItemData(row_ix, self.evnt_txt_list[i][0])
for j in xrange(1, len(evnt_t)):
col_ix= j
txt= evnt_t[j]
if type(txt) == types.ListType:
#column-text is a list of texts: add a new row
#and put in the last column (so I want to do)
for k in xrange(0, len(txt)):
if k > 0:
row_ix= row_ix +1
self.event_list.SetItemData(row_ix, self.evnt_txt_list[i][0])
self.event_list.InsertStringItem(row_ix, '')
self.event_list.SetStringItem(row_ix, col_ix, txt[k])
else:
self.event_list.SetStringItem(row_ix, col_ix, evnt_t[j])
row_ix= row_ix +1
for i in xrange(0, cnt_col):
hw= self.event_list.GetTextExtent(col_h[i])[0] +12 #12 is
experienced
self.event_list.SetColumnWidth(i, wxLIST_AUTOSIZE) #wxLIST_AUTOSIZE
not for GTK (in the doc)?
cw= self.event_list.GetColumnWidth(i)
if cw < hw:
self.event_list.SetColumnWidth(i, hw)
regards, Udo Floegel