---
name: "wxGridCellAttr"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxGridCellAttr"
---

# wxGridCellAttr(3erl)

Functions for wxGridCellAttr class

## NAME

wxGridCellAttr - Functions for wxGridCellAttr class

## DESCRIPTION

This class can be used to alter the cells' appearance in the grid by changing their attributes from the defaults. An object of this class may be returned by *wxGridTableBase::GetAttr()* (not implemented in wx).

Note that objects of this class are reference-counted and it's recommended to use wxGridCellAttrPtr smart pointer class when working with them to avoid memory leaks.

wxWidgets docs: wxGridCellAttr

## DATA TYPES

```
wxGridCellAttr() = wx:wx_object()
```

## EXPORTS

```
setTextColour(This, ColText) -> ok
```

Types:

This = wxGridCellAttr()\
 ColText = wx:wx\_colour()\

Sets the text colour.

```
setBackgroundColour(This, ColBack) -> ok
```

Types:

This = wxGridCellAttr()\
 ColBack = wx:wx\_colour()\

Sets the background colour.

```
setFont(This, Font) -> ok
```

Types:

This = wxGridCellAttr()\
 Font = wxFont:wxFont()\

Sets the font.

```
setAlignment(This, HAlign, VAlign) -> ok
```

Types:

This = wxGridCellAttr()\
 HAlign = VAlign = integer()\

Sets the alignment.

*hAlign* can be one of *wxALIGN\_LEFT*, *wxALIGN\_CENTRE* or *wxALIGN\_RIGHT* and *vAlign* can be one of *wxALIGN\_TOP*, *wxALIGN\_CENTRE* or *wxALIGN\_BOTTOM*.

```
setReadOnly(This) -> ok
```

Types:

This = wxGridCellAttr()\

```
setReadOnly(This, Options :: [Option]) -> ok
```

Types:

This = wxGridCellAttr()\
 Option = {isReadOnly, boolean()}\

Sets the cell as read-only.

```
setRenderer(This, Renderer) -> ok
```

Types:

This = wxGridCellAttr()\
 Renderer = wxGridCellRenderer:wxGridCellRenderer()\

Sets the renderer to be used for cells with this attribute.

Takes ownership of the pointer.

```
setEditor(This, Editor) -> ok
```

Types:

This = wxGridCellAttr()\
 Editor = wxGridCellEditor:wxGridCellEditor()\

Sets the editor to be used with the cells with this attribute.

```
hasTextColour(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid text colour set.

```
hasBackgroundColour(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid background colour set.

```
hasFont(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid font set.

```
hasAlignment(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid alignment set.

```
hasRenderer(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid cell renderer set.

```
hasEditor(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this attribute has a valid cell editor set.

```
getTextColour(This) -> wx:wx_colour4()
```

Types:

This = wxGridCellAttr()\

Returns the text colour.

```
getBackgroundColour(This) -> wx:wx_colour4()
```

Types:

This = wxGridCellAttr()\

Returns the background colour.

```
getFont(This) -> wxFont:wxFont()
```

Types:

This = wxGridCellAttr()\

Returns the font.

```
getAlignment(This) -> {HAlign :: integer(), VAlign :: integer()}
```

Types:

This = wxGridCellAttr()\

Get the alignment to use for the cell with the given attribute.

If this attribute doesn't specify any alignment, the default attribute alignment is used (which can be changed using *wxGrid:setDefaultCellAlignment/3* but is left and top by default).

Notice that *hAlign* and *vAlign* values are always overwritten by this function, use *GetNonDefaultAlignment()* (not implemented in wx) if this is not desirable.

```
getRenderer(This, Grid, Row, Col) ->
               wxGridCellRenderer:wxGridCellRenderer()
```

Types:

This = wxGridCellAttr()\
 Grid = wxGrid:wxGrid()\
 Row = Col = integer()\

Returns the cell renderer.

The caller is responsible for calling *DecRef()* (not implemented in wx) on the returned pointer, use *GetRendererPtr()* (not implemented in wx) to do it automatically.

```
getEditor(This, Grid, Row, Col) ->
             wxGridCellEditor:wxGridCellEditor()
```

Types:

This = wxGridCellAttr()\
 Grid = wxGrid:wxGrid()\
 Row = Col = integer()\

Returns the cell editor.

The caller is responsible for calling *DecRef()* (not implemented in wx) on the returned pointer, use *GetEditorPtr()* (not implemented in wx) to do it automatically.

```
isReadOnly(This) -> boolean()
```

Types:

This = wxGridCellAttr()\

Returns true if this cell is set as read-only.

```
setDefAttr(This, DefAttr) -> ok
```

Types:

This = DefAttr = wxGridCellAttr()\
