[wxPython] Right justify columns in wxListCtrl

In report mode I am attempting to right justify a column and I am not
having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
so any help would be greatly appreciated.

The following does not work:

list.InsertColumn(0, "Heading", wxLIST_FORMAT_RIGHT)

nor does this method seem to work

info = wxListItem()
info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT
info.m_format = wxLIST_FORMAT_RIGHT
info.m_text = "Heading"
info.m_col = 0
list.InsertColumnInfo(0, info)

I don't get any errors but the text remains left justified in the
column. Any thoughts?

On another note, I took a look at GetItem() and the m_format returned
there is consistenly wxLIST_FORMAT_CENTER. Interestingly enough, the
value returned by GetColumn() is correct and Robin checked in something
to fix that on August 14 -- perhaps the same code ought to be applied
here???

And one final question, wxWindows 2.3.3 was released yesterday. Any idea
when wxPython 2.3.3 will be released? Or am I jumping the gun a bit...
:slight_smile:

···

--
Anthony Tuininga
anthony@computronix.com

Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
http://www.computronix.com

Let me give some additional information which I should have given
before.

First, this is running wxPython 2.3.3pre6 on both platforms.
Second, GetColumn() always returns wxLIST_FORMAT_LEFT on Windows but the
right value on Linux.

···

On Tue, 2002-09-17 at 11:52, Anthony Tuininga wrote:

In report mode I am attempting to right justify a column and I am not
having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
so any help would be greatly appreciated.

The following does not work:

list.InsertColumn(0, "Heading", wxLIST_FORMAT_RIGHT)

nor does this method seem to work

info = wxListItem()
info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT
info.m_format = wxLIST_FORMAT_RIGHT
info.m_text = "Heading"
info.m_col = 0
list.InsertColumnInfo(0, info)

I don't get any errors but the text remains left justified in the
column. Any thoughts?

On another note, I took a look at GetItem() and the m_format returned
there is consistenly wxLIST_FORMAT_CENTER. Interestingly enough, the
value returned by GetColumn() is correct and Robin checked in something
to fix that on August 14 -- perhaps the same code ought to be applied
here???

And one final question, wxWindows 2.3.3 was released yesterday. Any idea
when wxPython 2.3.3 will be released? Or am I jumping the gun a bit...
:slight_smile:

--
Anthony Tuininga
anthony@computronix.com

Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
http://www.computronix.com

--
Anthony Tuininga
anthony@computronix.com

Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838

In report mode I am attempting to right justify a column and I am not
having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
so any help would be greatly appreciated.

It's not implemented yet in the generic wxListCtrl (used on wxGTK and
wxMac), but it *is* supported on wxMSW as long as the native LIstView
control does, maybe your common controls DLL needs updated. Does it not do
it in the demo either?

First, this is running wxPython 2.3.3pre6 on both platforms.
Second, GetColumn() always returns wxLIST_FORMAT_LEFT on Windows but the
right value on Linux.

It returns the right value on MSW for me, but then since you don't get any
right justification on MSW I guess wxLIST_FORMAT_LEFT is the right answer,
right? <wink>

And one final question, wxWindows 2.3.3 was released yesterday. Any idea
when wxPython 2.3.3 will be released? Or am I jumping the gun a bit...
:slight_smile:

Soon.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Anthony Tuininga wrote:

In report mode I am attempting to right justify a column and I am not
having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
so any help would be greatly appreciated.

The following does not work:

list.InsertColumn(0, "Heading", wxLIST_FORMAT_RIGHT)

According to MSDN first column (0) is allways left aligned, but you can leave dumy column 0 insert column 1 with RIGHT and delete dummy column 0.

HTH
Niki Spahiev

Bingo. That solves the problem alright. Perhaps it would be useful to
include this tidbit in wxWindows itself... :slight_smile:

···

On Wed, 2002-09-18 at 02:12, Niki Spahiev wrote:

Anthony Tuininga wrote:
> In report mode I am attempting to right justify a column and I am not
> having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
> so any help would be greatly appreciated.
>
> The following does not work:
>
> list.InsertColumn(0, "Heading", wxLIST_FORMAT_RIGHT)

According to MSDN first column (0) is allways left aligned, but you can
leave dumy column 0 insert column 1 with RIGHT and delete dummy column 0.

HTH
Niki Spahiev

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Anthony Tuininga
anthony@computronix.com

Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838

> In report mode I am attempting to right justify a column and I am not
> having any luck on either Linux (Red Hat 7.3) or Windows (Windows 2000)
> so any help would be greatly appreciated.

It's not implemented yet in the generic wxListCtrl (used on wxGTK and
wxMac), but it *is* supported on wxMSW as long as the native LIstView
control does, maybe your common controls DLL needs updated. Does it not do
it in the demo either?

It does work in the demo. But as it turns out, that is only because it
isn't the first column -- see other e-mail in this thread. Adding a
dummy column first, then adding the real column and removing the dummy
column gets around this foolishness. Perhaps this ought to be included
in wxWindows itself?

> First, this is running wxPython 2.3.3pre6 on both platforms.
> Second, GetColumn() always returns wxLIST_FORMAT_LEFT on Windows but the
> right value on Linux.

It returns the right value on MSW for me, but then since you don't get any
right justification on MSW I guess wxLIST_FORMAT_LEFT is the right answer,
right? <wink>

Yep. See above.

···

On Tue, 2002-09-17 at 15:27, Robin Dunn wrote:

>
> And one final question, wxWindows 2.3.3 was released yesterday. Any idea
> when wxPython 2.3.3 will be released? Or am I jumping the gun a bit...
> :slight_smile:

Soon.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Anthony Tuininga
anthony@computronix.com

Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838