From: Luis M. G. <lu...@gm...> - 2006-07-18 13:52:36
|
Thank you Alex! I tried all what you said, with different results: >>The default for a PythonCard MulticolumnList is that all columns will = be wx.LIST_AUTOSIZE (and the last one will be expanded to fill remaining = space). =20 >> That's why the MultiColumn example works :-) I have two nulticolumnlists, one is created and filled on_initialize, = and the other is filled when I select a record on the first one = (invoices - invoice details). The first one shows records as you said (like wx.LIST_AUTOSIZE), but = the second one cuts the headers and items text with a narrower width. >> PythonCard doesn't support calling SetColumnWidth, though you might = be able to call wx directly.=20 Actually, it works. But only if I use it after adding data to the multicolumnlist (not = before). And it only accepts integers as width parameter, (not wx.LIST_AUTOSIZE = and not even a variable containing an int). >> What PythonCard does support is setting the column width as part of = setting the column headings=20 >> (see the documentation in the comments of multicolumnExample.py, or = look at components/multicolumnlist.py to see what it does, in = particular _setColumnHeadings() ).=20 The demo code documentation talks about "SetColumnHeadings", which as = far as I know is not implemented. If I use "columnHeadings" for assigning a list of lists as you said, = this is what I get: sc.MultiColumnList2.columnHeadings =3D [ ['DESCRIPCION', = wx.LIST_AUTOSIZE], ... AttributeError: 'module' object has no attribute 'LIST_AUTOSIZE' (Same result if I use "setColumnHeadings"). However, it works if I only add the headers text with = "columnHeadings". My source could wouldn't be of much help, because it uses a mysql = database to display data, but I can send it to you if you want... Anyway, I'll experiment a litle more to see what I'm doing wrong... Thanks! LUIS ----- Original Message -----=20 From: Alex Tweedly=20 To: Luis M. Gonzalez=20 Cc: Carl Wenrich ; pyt...@li...=20 Sent: Tuesday, July 18, 2006 9:41 AM Subject: Re: [Pythoncard-users] MultiColumnList: How to set columns = width? Luis M. Gonzalez wrote:=20 Hmmm... does it mean that I have to create "MultiColumnList1" as a = wx.ListCtrl from scratch? I tried that, but I get a "cannot import wxlistctrl" error message, = which I guess has something to do with the resource file... Anyway, how does the Multicolumn list sample work? It is a pure PythonCard app, with no wxPython tricks, and it works = just the way I want... The default for a PythonCard MulticolumnList is that all columns will = be wx.LIST_AUTOSIZE (and the last one will be expanded to fill remaining = space). That's why the MultiColumn example works :-) PythonCard doesn't support calling SetColumnWidth, though you might be = able to call wx directly. What PythonCard does support is setting the = column width as part of setting the column headings (see the = documentation in the comments of multicolumnExample.py, or look at = components/multicolumnlist.py to see what it does, in particular = _setColumnHeadings() ).=20 You set the columnHeadings by simply assigning to 'columnHeadings', = with either 1. a list of strings or 2. a list of lists - containing a string, and a width (# pixels or = wx.LIST_AUTOSIZE or 3. a list of lists - containing a string, a width (as above) and a = format (e.g. wx.LIST_FORMAT_LEFT) Note that if you look at the column headings (e.g.=20 print self.theList.columnHeadings you will see only the string (titles). You can also do print self.theList.GetColumnHeadingInfo() to see the complete (i.e. string, width, format) column heading data. So you can do things like the following (typed carefully, but not = tested) .... self.theList =3D self.components.myMultiColumnList # these can generally be either Tuples or Lists ... Lists used = here for ease of typing=20 # a simple list of strings self.theList.columnHeadings =3D ['name', 'address', 'age'] or # a list of lists - each contains the string the for heading text, = and an integer for the width self.theList.columnHeadings =3D [ ['name', wx.LIST_AUTOSIZE], ['address', = wx.LIST_AUTOSIZE], ['age', = wx.LIST_AUTOSIZE] ] etc. =20 If this doesn't help - could you send a sample code/rsrc file to = explain isn't working ... btw - If I'm reading the code properly, it doesn't fully support a mix = of auto-sized and fixed-size columns - but that isn't explicitly stated, = so you may need to experiment if you need to do that (it does support it = - but once you have set some cols to be fixed-width, the ability default = to AUTOSIZE is lost, and thereafter you need to always use the explicit = method to specify wx.LIST_AUTOSIZE). --=20 Alex Tweedly http://www.tweedly.net -------------------------------------------------------------------------= ----- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: = 17/07/2006 |