• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

DecisionGrid problem

How do I get the rowvalue and columnvalue for a selected cell in a DecisionGrid?
0
svenj
Asked:
svenj
  • 2
  • 2
1 Solution
 
viktornetCommented:
Use MouseCoord()..... Somthing from the help file....

Returns the row and column indexes of the cell that contains a point specified in screen coordinates.

type TGridCoord = record

    X: Longint;
    Y: Longint;
  end;

function MouseCoord(X, Y: Integer): TGridCoord;

Description

Call MouseCoord to locate the column and row of the cell which contains a given screen coordinate. Usually, MouseCoord is used to locate the cell which is under the mouse.


-Viktor
--Ivanov
0
 
viktornetCommented:
You use MouseCoord() in the OnMouseDown() of the DecisionGrid so you check which one is selected.,,,
0
 
kretzschmarCommented:
Hi Viktornet,

i don't think that your answer reflected the question. To get the Value of the selected Cell allways (by click or keyboard) he can use this in DecisionDrawCel Event of the DecisionGrid

procedure TForm1.DecisionGrid1DecisionDrawCell(Sender: TObject; Col,
  Row: Integer; var Value: String; var aFont: TFont; var aColor: TColor;
  AState: TGridDrawState; aDrawState: TDecisionDrawState);
begin
  if (gdselected in aState) then
    edit2.text := DecisionGrid1.Cells[col,row];
end;

But I think he/she will access the sum values of the Row and of the Colum of the selected Cell. Not so Easy.

meikl
0
 
svenjAuthor Commented:
Thank you viktornet,
That worked just fine, many thanks!

svenj

0
 
kretzschmarCommented:
a Misunderstanding!

meikl
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now