Hi Bruno,
is first time who i have some problem usin grid loacate.
In a form i have grid, edit and buttons.
The grid has several colums and where i need to do a search are only in column 2 and 3 where on column 2 is a string search and column 3 is a numeric search.
This is the procedure when the enter key is pressed.
procedure TFLTSR.Edt1KeyPress(Sender: TObject; var Key: Char);
var Loc : TPoint;
Fp : TFindParams;
I : Integer;
begin
if (Key=#13) and (Edt1.Text<>'') then
begin
try
I:=StrToInt(Edt1.Text);
except
I:=-1
end;
if I=-1 then SG1.Col:=2 // String
else
SG1.Col:=3; // Num
Loc.X:=-1;
Loc.Y:=-1;
Fp := [fnMatchRegular, fnAutoGoto, fnFindInCurrentCol];
Loc := SG1.Find(loc, Edt1.Text + '*',fp);
end;
end;
With this procedure col is always 1, there's no way to change the value.
fnFindInCurrentCol read grid.col or other value?
Thank's for reply
Daniele
If you set grid.Col = X and specify, fnFindInCurrentCol in the find parameters, it should start the search in column X. I cannot see a different behavior here.
Hi Bruno,
honestly ... i have a little problem ....
It's possible that i have some problem on my pc ... but in each code line where i have this line
Grid.Col:=X
the col value is always 1.
So in this procedure
procedure TAdvStringGrid.SetColEx(const Value: Integer);
begin
inherited Col := Value; // 1
FDisSelection := Selection; // 2
on line 1 Value is properly set on (for example) 2, inherited is executed tring to change value; But when return to line 2, Value is 2 as setted ... but Col remain 1.
So i investigate a little ... and the problem seem to be goRowSelect.
If is setted to True there's no way to change a col property ..... but in case of search replace work goRowSelect couldbe transparent.
Thank's for all your help.
Daniele
Hi Bruno,
i forgot to write who i before changing col value, i remove gorowselect do a locate and after reset gorowselect.
workaround ... but work !!
Daniele
When goRowSelect = true, the entire row is selected, so in this case it will indeed not work to select a single cell within a selected row.