Some questions about wx.ListCtrl

I have been making a program that uses a wx.ListCtrl, and I have some
problems. First of all, I can't figure out how to give it a sunken
border. I have tried the following styles:

wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SORT_ASCENDING

wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SORT_ASCENDING

and neither gives me the desired result. Also, the columns don't
appear. Maybe this is because I only have one column, but maybe not. I
would appreciate any help.

--Ratfink

I used StyledTextCtrl for my 'Tobu' program and it seemed like the best choice because it offered unlimited undo. Now I'm trying to add styled text and I ran into a problem that you can't just keep adding styles for any chunk of text you want, like in a word editor. It has a number of preset styles like opening brace, closing brace, etc. I can set these to look in a certain way and then apply that style to a selection, but if I make a new selection and change that style, the change will of course be applied to the old selection, too. Is it at all possible to work around this somehow? I tried larger int numbers for styles but it seems that STC_STYLE_MAX = 127 so I can't go over that, and in fact even '40' I tried did not work.

I can do a dozen of buttons from 1 to 12 and then let user set up these 12 styles and use them in text areas, but this is kind of crappy. Actually for most needs of this program this would be more than enough, because it's mostly a text editor and styles would just be used for headers, but it still makes a very unprofessional impression, so I'd prefer to avoid this.

Do I need to use some other type of text controller instead of StyledTextCtrl? Is there anything that works as well and also has multiple undo?

Another issue is that if I change size of text of a word, line spacing for the whole document changes (if size is more than default size for that doc).

thx, -ak

I'm not sure that the sunken border style applies to all windows. You
can try to place the list control on a Panel to see if it works
there...

In terms of the columns not appearing, could you provide us with a
minimal sample app that shows what you are doing? Also providing your
platform, Python version, and wxPython versions would be nice too.

Thanks,
- Josiah

···

On Tue, Jul 1, 2008 at 5:09 PM, Clay Hobbs <clay@lakeserv.net> wrote:

I have been making a program that uses a wx.ListCtrl, and I have some
problems. First of all, I can't figure out how to give it a sunken
border. I have tried the following styles:

wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SORT_ASCENDING

wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SORT_ASCENDING

and neither gives me the desired result. Also, the columns don't
appear. Maybe this is because I only have one column, but maybe not. I
would appreciate any help.

editor component that you are using as StyledTextCtrl), it is not
meant as a rich text edit control like MS Word, it's meant as an
auto-styling source code editing control (hence why there are
programming language syntax styles). Many of your questions would be
answered by looking at the documentation there.

In terms of you only being able to use a fixed number of styles, see
SetStyleBits(7) to use 128 styles (0..127) (generally for the method
names in the scintilla docs, you translate from ALLCAPS to
LeadingCaps).

- Josiah

···

On Tue, Jul 1, 2008 at 8:26 PM, AK <andrei.avk@gmail.com> wrote:

I used StyledTextCtrl for my 'Tobu' program and it seemed like the best
choice because it offered unlimited undo. Now I'm trying to add styled text
and I ran into a problem that you can't just keep adding styles for any
chunk of text you want, like in a word editor. It has a number of preset
styles like opening brace, closing brace, etc. I can set these to look in a
certain way and then apply that style to a selection, but if I make a new
selection and change that style, the change will of course be applied to the
old selection, too. Is it at all possible to work around this somehow? I
tried larger int numbers for styles but it seems that STC_STYLE_MAX = 127 so
I can't go over that, and in fact even '40' I tried did not work.

I can do a dozen of buttons from 1 to 12 and then let user set up these 12
styles and use them in text areas, but this is kind of crappy. Actually for
most needs of this program this would be more than enough, because it's
mostly a text editor and styles would just be used for headers, but it still
makes a very unprofessional impression, so I'd prefer to avoid this.

Do I need to use some other type of text controller instead of
StyledTextCtrl? Is there anything that works as well and also has multiple
undo?

Another issue is that if I change size of text of a word, line spacing for
the whole document changes (if size is more than default size for that doc).

From what I understand of the base editor from scintilla.org (the

Hello,

···

On Jul 1, 2008, at 10:26 PM, AK wrote:

Another issue is that if I change size of text of a word, line spacing for the whole document changes (if size is more than default size for that doc).

This is a simplification/optimization Scintilla makes for drawing the screen. The lines will all be the same size as the line with the largest font height.

Cody