NextGrid Row Click
#1
Posted 08 October 2006 - 10:53 AM
So, I downloaded NextGrid and I have a little problem: I don't know how to detect when a user double clicks on a row. I want that text in that rows to be placed in a variable or something so i can edit it.
If you can help me, please add a reply.
Thank You
#2
Posted 08 October 2006 - 11:42 AM
Try the following in the grid's doubleclick event:
var
s: string;
begin
//to get the text
s := NextGrid1.Cells[0,NextGrid1.SelectedRow].AsString;
//to set the text
NextGrid1.Cells[0,NextGrid1.SelectedRow].AsString := s;
end;
(Replace "0" with column index for which you want the value)
#3
Posted 08 October 2006 - 12:31 PM
If i have any questios i'll post them here
#4
Posted 10 October 2006 - 07:09 PM
var
s: string;
i:integer;
begin
i:=NextGrid1.SelectedRow;
s := NextGrid1.Cells[0,i]; ShowMessage(s);
end;
but when i double click on the grid nothing happens. What did I do wrong?
I must say that I am a beginner in OOP
#5
Posted 10 October 2006 - 08:26 PM
Actually you don't even need the variables. You could just say:
ShowMessage(NextGrid1.Cells[0,NextGrid1.SelectedRow].AsString);
#6
Posted 10 October 2006 - 08:47 PM
What is to be done?
#7
Posted 10 October 2006 - 09:58 PM
Try using Cell instead of Cells
#8
Posted 11 October 2006 - 02:58 AM
Yes, use Cell[x,y]. Thank you deonvn for helping
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#9
Posted 11 October 2006 - 07:31 PM
var
s: string;
i:integer;
begin
//to get the text
s := NextGrid1.Cell[0,NextGrid1.SelectedRow].AsString;
ShowMessage(s);
end;
//End Next Grid1.DoubleClick
and it still doesn't work
#10
Posted 11 October 2006 - 08:22 PM
Did you add any rows to your grid (using AddRow)?
If so, does the first column of the row you are double-clicking on have any text in it?
#11
Posted 11 October 2006 - 08:45 PM
2.Yes. It looks like in this image
berccomp.PNG 3.25KB 47 downloads
#12
Posted 11 October 2006 - 08:49 PM
I have attached a sample with AddCells and DoubleClick.
Attached Files
#13
Posted 12 October 2006 - 03:53 PM
I'm using Delphi 7.
And when i try to compile without nxcollection.dcu it says "Could not create output file d:\projects\project1.exe"
but this project is stored in d:\downloads\doubleclick\
#14
Posted 12 October 2006 - 03:58 PM
If you are using version without sources, simply remove NxCollection from unit from uses section.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#15
Posted 12 October 2006 - 05:47 PM
From the main menu, select Project --> Options.
On the Directories and Conditionals tab, change the output path to a path that exists (or make it blank).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users