Board index » cppbuilder » Enabling or disabling a cell in TStringGrid

Enabling or disabling a cell in TStringGrid

Hi everyone!

I want to be able to navigate a TStringGrid but I want to disable editing in
some cells (sometimes entire columns or rows, but sometimes individual
cells).

How can I do this?

Thanks!

--
Ferran Barba
Serveis Informtics
E-mail: ferran.ba...@sifbm.com

 

Re:Enabling or disabling a cell in TStringGrid


On Fri, 2 Aug 2002 09:10:36 +0200, "Ferran Barba" <r...@sifbm.com>
wrote:

Quote
>I want to be able to navigate a TStringGrid but I want to disable editing in
>some cells (sometimes entire columns or rows, but sometimes individual
>cells).

IIRC I did it by setting or clearing the goEditing option in the
grid's OnClick handler, based on the Row and Col property values,
but OnSelectCell would probably work just as well.

Re:Enabling or disabling a cell in TStringGrid


"Michael Warner" <m...@ozemail.com.au> escribi en el mensaje
news:dlnkku46e2a5f3qj4jstdi8rj1aauu3qiq@4ax.com...

Quote
> On Fri, 2 Aug 2002 09:10:36 +0200, "Ferran Barba" <r...@sifbm.com>
> wrote:

> >I want to be able to navigate a TStringGrid but I want to disable editing
in
> >some cells (sometimes entire columns or rows, but sometimes individual
> >cells).

> IIRC I did it by setting or clearing the goEditing option in the
> grid's OnClick handler, based on the Row and Col property values,
> but OnSelectCell would probably work just as well.

I have been trying just that but it doesn't work for me: I have to be able
to select the cell but I don't want the user to change it's value.

I've found a way (a bit clumsy but it works): to trap the OnSetEditText
event and put the same value that's in the cell. This way it never changes.

Thanks!

Re:Enabling or disabling a cell in TStringGrid


On Fri, 2 Aug 2002 12:33:56 +0200, "Ferran Barba" <r...@sifbm.com>
wrote:

Quote
>I have been trying just that but it doesn't work for me: I have to be able
>to select the cell but I don't want the user to change it's value.

I wasn't suggesting that you use OnSelectCell to prevent the user from
selecting the cell. Does changing goEditing prevent that for you?

Other Threads