Solved

# DecisionGrid problem

Posted on 1999-01-19
191 Views
How do I get the rowvalue and columnvalue for a selected cell in a DecisionGrid?
0
Question by:svenj
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
• 2
• 2

LVL 10

Accepted Solution

viktornet earned 10 total points
ID: 1362426
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

LVL 10

Expert Comment

ID: 1362427
You use MouseCoord() in the OnMouseDown() of the DecisionGrid so you check which one is selected.,,,
0

LVL 27

Expert Comment

ID: 1362428
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

Author Comment

ID: 1362429
Thank you viktornet,
That worked just fine, many thanks!

svenj

0

LVL 27

Expert Comment

ID: 1362430
a Misunderstanding!

meikl
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Title # Comments Views Activity
Printing problem 2 122
Delphi...Split view - idea? 1 142
Tvertscrollbox like a whatsapp layout delete messages 1 49
Get weeknumber and year from date 4 55
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
###### Suggested Courses
Course of the Month8 days, 3 hours left to enroll

#### 739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.