"Decorating" a grid column label

I have some grids that the user can sort by clicking a column label. I'd like to visually show which column the grid is sorted by. One approach is to add some small icons to the grid column label (similar to the small up/down arrows in some windows apps). Does anyone have any suggestions on how I could do this? How have other people approached this sort of problem?

And for extra credit, a related problem -- some of the grids in my app have some columns which may be edited, and some which are read-only. Again, I'd like to show this visually. Any ideas?

Thanks in advance,

Rad Widmer

I have some grids that the user can sort by clicking a column label. I'd like to visually show which column the grid is sorted by. One approach is to add some small icons to the grid column label (similar to the small up/down arrows in some windows apps). Does anyone have any suggestions on how I could do this? How have other people approached this sort of problem?

Either change the label (seems to be what you're thinking), or to change
the background color of the data columns.

And for extra credit, a related problem -- some of the grids in my app have some columns which may be edited, and some which are read-only. Again, I'd like to show this visually. Any ideas?

In my app, the "obvious" choice was to set the background color to grey
where the cells weren't editable. This is relatively flexible, as it can
indicate partial columns, not just whole columns, though that may not be
important for your app.

   -frank

···

On Wed, 22 Jun 2005, Rad Widmer wrote:

OK, I guess I should of been a little more specific. What I was thinking of doing is adding a small up/down arrow (really just a triangle) above the column label text (I'm pressed for horizontal space). How could I do this?

Thanks,

Rad

···

On Wed, 22 Jun 2005, Rad Widmer wrote:

I have some grids that the user can sort by clicking a column label. I'd like to visually show which column the grid is sorted by. One approach is to add some small icons to the grid column label (similar to the small up/down arrows in some windows apps). Does anyone have any suggestions on how I could do this? How have other people approached this sort of problem?

Either change the label (seems to be what you're thinking), or to change
the background color of the data columns.

And for extra credit, a related problem -- some of the grids in my app have some columns which may be edited, and some which are read-only. Again, I'd like to show this visually. Any ideas?

In my app, the "obvious" choice was to set the background color to grey
where the cells weren't editable. This is relatively flexible, as it can
indicate partial columns, not just whole columns, though that may not be
important for your app.

-frank

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Yes, thanks Sorin. That just the sort of thing I was looking for. Although it's a bit more *work* than I would have liked. Good thing I already have my own custom grid base classes!

Rad

···

----- Original Message ----- From: "Sorin Chiorean" <sosopub@gmail.com>
To: <wxPython-users@lists.wxwidgets.org>
Sent: Wednesday, June 22, 2005 4:16 PM
Subject: Re: [wxPython-users] "Decorating" a grid column label

Hi,

This is the place which get me started to my exactly-like-yours requirement:

http://wiki.wxpython.org/index.cgi/DrawingOnGridColumnLabel

Sorin

On 6/22/05, Rad Widmer <rwidmer@eclypse.org> wrote:

OK, I guess I should of been a little more specific. What I was thinking of doing is adding a small
up/down arrow (really just a triangle) above the column label text (I'm pressed for horizontal
space). How could I do this?

Thanks,

Rad

> On Wed, 22 Jun 2005, Rad Widmer wrote:
>
>> I have some grids that the user can sort by clicking a column label. I'd like to visually show
>> which column the grid is sorted by. One approach is to add some small icons to the grid column
>> label (similar to the small up/down arrows in some windows apps). Does anyone have any
>> suggestions on how I could do this? How have other people approached this sort of problem?
>
> Either change the label (seems to be what you're thinking), or to change
> the background color of the data columns.
>
>> And for extra credit, a related problem -- some of the grids in my app have some columns which
>> may be edited, and some which are read-only. Again, I'd like to show this visually. Any ideas?
>
> In my app, the "obvious" choice was to set the background color to grey
> where the cells weren't editable. This is relatively flexible, as it can
> indicate partial columns, not just whole columns, though that may not be
> important for your app.
>
> -frank
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
Sorin

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

You can look at the code in the dGrid class of Dabo to see how we do it. Or you can simply use Dabo, which wraps wxPython and has stuff like this built-in.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/

···

On Jun 22, 2005, at 3:24 PM, Rad Widmer wrote:

I have some grids that the user can sort by clicking a column label. I'd like to visually show which column the grid is sorted by. One approach is to add some small icons to the grid column label (similar to the small up/down arrows in some windows apps). Does anyone have any suggestions on how I could do this? How have other people approached this sort of problem?

Thanks Ed, the Dabo code looks good. I notice one glitch with both the Dabo and the wiki code, however. If a column width is less than the width of the column label, the label is not clipped properly. Shoudn't the dc.DrawLabel method clip to the rect parameter? I assume that rect correctly describes the column label rectangle.

Rad

···

On Jun 22, 2005, at 3:24 PM, Rad Widmer wrote:

I have some grids that the user can sort by clicking a column label. I'd like to visually show which column the grid is sorted by. One approach is to add some small icons to the grid column label (similar to the small up/down arrows in some windows apps). Does anyone have any suggestions on how I could do this? How have other people approached this sort of problem?

You can look at the code in the dGrid class of Dabo to see how we do it. Or you can simply use Dabo, which wraps wxPython and has stuff like this built-in.

     ___/
    /
   __/
  /
____/
Ed Leafe
http://leafe.com/
http://dabodev.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

That's been corrected in the current version (either the nightly builds, or from the Subversion repository). We've abandoned drawing the entire column label, and let wxPython write the text. The current version just handles drawing the little sorting icon.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/

···

On Jun 23, 2005, at 11:04 AM, Rad Widmer wrote:

Thanks Ed, the Dabo code looks good. I notice one glitch with both the Dabo and the wiki code, however. If a column width is less than the width of the column label, the label is not clipped properly. Shoudn't the dc.DrawLabel method clip to the rect parameter? I assume that rect correctly describes the column label rectangle.

Thanks, Ed, I'll check it out.

···

On Jun 23, 2005, at 11:04 AM, Rad Widmer wrote:

Thanks Ed, the Dabo code looks good. I notice one glitch with both the Dabo and the wiki code, however. If a column width is less than the width of the column label, the label is not clipped properly. Shoudn't the dc.DrawLabel method clip to the rect parameter? I assume that rect correctly describes the column label rectangle.

That's been corrected in the current version (either the nightly builds, or from the Subversion repository). We've abandoned drawing the entire column label, and let wxPython write the text. The current version just handles drawing the little sorting icon.

     ___/
    /
   __/
  /
____/
Ed Leafe
http://leafe.com/
http://dabodev.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org