Recent

Author Topic: TStringGrid Cell Editing  (Read 19979 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
TStringGrid Cell Editing
« on: May 17, 2010, 05:34:40 pm »
I'm stumped with TStringGrid and must be missing something very simple. I'm running OS X 10.6.3 with Lazarus 0.9.29, FPC 2.4.0, i386-darwin-qt (beta).

I place a TStringGrid on a form, run it, select a cell, but then can't get the cell editor to activate. AutoEdit is True, what am I missing? I've been at it for hours.

Frederick

“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: TStringGrid Cell Editing
« Reply #1 on: May 17, 2010, 05:43:14 pm »
Did you set goEditing in Options to true?

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: TStringGrid Cell Editing
« Reply #2 on: May 17, 2010, 05:52:14 pm »
No...   :-[

It seems is working now, many thanks!

Sorry, fumbling my way forward.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: TStringGrid Cell Editing
« Reply #3 on: October 27, 2010, 08:25:52 am »
1. How could we write code for this line?
2. And how to hide the vertical line of non fixed cells in such TStringGrid ?
Lazarus 1.2.4 / Win 32 / THAILAND

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: TStringGrid Cell Editing
« Reply #4 on: October 27, 2010, 09:17:28 am »
1. How could we write code for this line?
2. And how to hide the vertical line of non fixed cells in such TStringGrid ?

1. I don't understand. Do you mean this:
 StringGrid1.Cells[1,1]:='hello';

2. Have a look at the Options property. (goVertLine)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: TStringGrid Cell Editing
« Reply #5 on: October 27, 2010, 09:40:15 am »
1. If

 StringGrid1.Cells[1,1]:='hello';

I will use the keyboard to edit to be 'Hi'

2. I have never used options of TStringGrid in coding,

 StringGrid1.options.??????

The default settings from the IDE are goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSect and goSmoothScroll.

I'd like to cancel goVertLine.
How could I code for this line?
Lazarus 1.2.4 / Win 32 / THAILAND

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: TStringGrid Cell Editing
« Reply #6 on: October 27, 2010, 11:34:37 am »
StringGrid1.Options:=StringGrid1.Options-[goVertLine]+[goEditing];

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: TStringGrid Cell Editing
« Reply #7 on: October 27, 2010, 01:02:22 pm »
Dear Theo

Thank you so much for your help.
Could you please introduce some documents for me in order to learn the syntax/code writing?

P.S. Or are there some Delphi books to substitute?
Lazarus 1.2.4 / Win 32 / THAILAND

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: TStringGrid Cell Editing
« Reply #8 on: October 27, 2010, 03:57:29 pm »
You can learn from Pascal or Delphi Books.
Here is one: http://www.marcocantu.com/epascal/
Delphibasics might help too (page for Sets):
http://www.delphibasics.co.uk/Article.asp?Name=Sets

 

TinyPortal © 2005-2018