Visual Cues for Grid Cell Choice Editor

I have a grid control in my application that contains several choice columns created with wx.grid.GridCellChoiceEditor. The problem is that the cells don’t identify themselves as choice cells until the user actually clicks or performs a keystroke within the cell. When the cursor is not in the cell, or when it is but no action has been taken, the cell looks just like any other grid cell. The user could tab in and out through the cell without knowing its type.

I’d like to make the cell visually consistent with non-grid choice fields by displaying the up-down arrows at all times. Is there a straightforward way to accomplish this?

Thanks!

You would do this by creating a custom GridCellRenderer class and assigning it to the cell's attributes. The renderers are used to draw the contents of the cell when the editor is not active. There are some samples in the demo, and you may want to look at using the wx.RendererNative class to help you draw the cell so it looks like the native widget.

···

On 6/25/12 8:06 PM, llanitedave wrote:

I have a grid control in my application that contains several choice
columns created with wx.grid.GridCellChoiceEditor. The problem is that
the cells don't identify themselves as choice cells until the user
actually clicks or performs a keystroke within the cell. When the
cursor is not in the cell, or when it is but no action has been taken,
the cell looks just like any other grid cell. The user could tab in and
out through the cell without knowing its type.

I'd like to make the cell visually consistent with non-grid choice
fields by displaying the up-down arrows at all times. Is there a
straightforward way to accomplish this?

--
Robin Dunn
Software Craftsman

Ah! Thanks for the pointer!

···

On Tuesday, June 26, 2012 10:20:45 AM UTC-7, Robin Dunn wrote:

On 6/25/12 8:06 PM, llanitedave wrote:

I have a grid control in my application that contains several choice

columns created with wx.grid.GridCellChoiceEditor. The problem is that

the cells don’t identify themselves as choice cells until the user

actually clicks or performs a keystroke within the cell. When the

cursor is not in the cell, or when it is but no action has been taken,

the cell looks just like any other grid cell. The user could tab in and

out through the cell without knowing its type.

I’d like to make the cell visually consistent with non-grid choice

fields by displaying the up-down arrows at all times. Is there a

straightforward way to accomplish this?

You would do this by creating a custom GridCellRenderer class and
assigning it to the cell’s attributes. The renderers are used to draw
the contents of the cell when the editor is not active. There are some
samples in the demo, and you may want to look at using the
wx.RendererNative class to help you draw the cell so it looks like the
native widget.


Robin Dunn

Software Craftsman

http://wxPython.org