Questions tagged [tstringgrid]

TStringGrid is VCL grid control designed to manage the handling of strings and associated objects in Delphi and related development tools. It is defined in the Grids.pas (or VCL.Grids.pas starting with Delphi XE2 version) unit.

The exact amount of features vary depending upon chosed devtool and its version.

Some documentation links include^

181 questions
2
votes
1 answer

Stringgrid wordwrap displays text twice

I want to display a long string in a string grid cell in a wordwrap format and found the following code to do so: procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); //enable wordwrap in…
Ashlar
  • 636
  • 1
  • 10
  • 25
2
votes
1 answer

Does range checking on TStringGrid cells work?

Below is code for a simple Delphi form application that sets cell values that are out of range for the specified TStringGrid that contains the cells. Running the program and clicking on the resulting grid on the displayed form should generate a run…
Jay Elston
  • 1,978
  • 1
  • 19
  • 38
2
votes
3 answers

Paint TStringGrid cells from outside OnDrawCell event, is it possible?

Is there any way to paint specific cells on Delphi's TStringGrid without using the OnDrawCell event, for instance if I click a button the specified cells will be painted depending on their content.
Raul
  • 656
  • 5
  • 17
2
votes
1 answer

From cell coordinates to Canvas pixel position on OnSelectCell event in tStringGrid in Delphi

The OnDrawCell event gives me a "Rect" record so that I know where the real pixel coordinates are: OnDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); On the other hand, the OnSelectCell only gives me the row/col…
ZioBit
  • 905
  • 10
  • 29
2
votes
2 answers

Grid index out of range on scrolling

i have this problem: I needed to hide a row in a string grid so i simply did something like: StringGrid.RowHeights[StringGrid.Row] := 0; So this basicly sets the row height to 0 and it looks hidden. But after i do this and if i try to scroll i got…
user5014677
  • 694
  • 6
  • 22
2
votes
2 answers

How to fill cell of a string grid using custom color?

I am trying to write custom date picker(calendar). The dates will be displayed on the stringgrid. I am trying to fill the clicked cell with a custom color and make that selected celltext bold. Here is my code: type TStringGrid =…
Rabi Jayasawal
  • 441
  • 1
  • 9
  • 18
2
votes
3 answers

TStringGrid column resize event?

TStringGrid has a TGridOption goColSizing that allows for automatic resizing of columns at runtime when you drag in the margin between the columns. Is there a corresponding event that is triggered when a column size occurs? I'd like to resize…
Jessica Brown
  • 8,222
  • 7
  • 46
  • 82
2
votes
0 answers

Prevent Select All behavior of TInplaceEditer in TStringgrid

When selecting a cell in TStringGrid the entire cell contents are selected, with the cursor positioned at the end of the selection. This is a problem. My grid is being populated via a Live Binding to a TADOConnnection to a FoxPro database, I have a…
Kevin Metzger
  • 43
  • 1
  • 7
2
votes
2 answers

Selectively ShowHint with StringGrid

In a StringGrid component descendant, I want to change the popup Hint message depending on the value of a cell. My coding: procedure TForm.GridMouseEnterCell(Sender: TObject; ACol, ARow: Integer); var k: integer; begin k :=…
bobonwhidbey
  • 485
  • 7
  • 17
2
votes
1 answer

plot stringgrid values on Tchart

I'm trying to plot a graph with some values on my Stringgrid. it has 140x140 rowxCol, numbers only. The Tchart should display on the X-axis the cell coordinates, in the y-axis the values. I'm using this code: procedure TForm2.Button2Click(Sender:…
Ammadeux
  • 325
  • 1
  • 5
  • 15
2
votes
1 answer

What does a StringGrid's OnSetEditText event do?

I thought OnSetEditText was fired whenever text in a cell changed. After setting a breakpoint and experimenting, I know that's wrong :-) So, first, when is this event fired? Second, if I would like to have the text inside a grid cell continuously…
Al C
  • 5,175
  • 6
  • 44
  • 74
2
votes
2 answers

Smooth scroll string grid

I need a string grid which can scroll smoothly, as opposed to locking in the top row / left col positions. When you scroll a TStringGrid, the left visible column and top visible row snap into position along the top/left edges. I need the ability for…
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
2
votes
1 answer

How to check whether a cell in a StringGrid is modified

I would like to know how to programatically determine that the data in a cell of the string grid is modified? I have a string grid in a form. The data for the stringgrid is loading from the Database. If a user modifies the data, I would like to…
user1469630
  • 191
  • 3
  • 5
  • 15
2
votes
1 answer

right justify delphi stringgrid column but keep themed drawingstyle

I am using delphi 2010 for a project with a stringgrid. I want some columns of the grid to be right justified. I understand how I can do this with defaultdrawing set to false. I would like, however, to keep the runtime theme shading for the grid, if…
Joe
  • 999
  • 1
  • 8
  • 20
1
vote
1 answer

How Can I Paint All The Column Title Cells Of A TStringGrid Different Colours?

I am running Lazarus 0.9.30.2. I have a TForm on which there is a TStringGrid. Each column title is a TGridColumns object that I added dynamically to the grid at run time. Each column title has an object associated with it (that I created and…
user1174918
  • 525
  • 6
  • 22