Fórum StringGrid sombra #23755
09/03/2010
0
Olá,gostaria de saber como implementar uma seleção e movimentação do ScrollBar entre 2 StrinGgrid.
Eu preciso clikar em uma célula do String1 e o String2 ficar selecionado acompanhando o String1.
Isso eu consigo usando o código;
SelectCell do String1;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
MyRect: TGridRect;
begin
Caption:=IntToStr(ACol)+ ' '+IntToStr(ARow);
MyRect.Left:=ACol; // coluna inicial
MyRect.Right:=ACol; // coluna final
MyRect.Top:=ARow; // linha inicial
MyRect.Bottom:=ARow; // linha final
stringGrid2.Selection:=MyRect;
end; SelectCell do String 2; procedure TForm1.StringGrid2SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
MyRect: TGridRect;
begin
MyRect.Left:=ACol; // coluna inicial
MyRect.Right:=ACol; // coluna final
MyRect.Top:=ARow; // linha inicial
MyRect.Bottom:=ARow; // linha final
stringGrid1.Selection:=MyRect;
end; Não conseguí implementar parar quando eu estiver no String2 (ou 1) e começo a descer as linhas,fazer que o outro String role seu ScrollBar para acompanhar um ao outro. Esses códigos postados são eficientes? Uso D7. Obrigado a quem ajudar.
ARow: Integer; var CanSelect: Boolean);
var
MyRect: TGridRect;
begin
Caption:=IntToStr(ACol)+ ' '+IntToStr(ARow);
MyRect.Left:=ACol; // coluna inicial
MyRect.Right:=ACol; // coluna final
MyRect.Top:=ARow; // linha inicial
MyRect.Bottom:=ARow; // linha final
stringGrid2.Selection:=MyRect;
end; SelectCell do String 2; procedure TForm1.StringGrid2SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
MyRect: TGridRect;
begin
MyRect.Left:=ACol; // coluna inicial
MyRect.Right:=ACol; // coluna final
MyRect.Top:=ARow; // linha inicial
MyRect.Bottom:=ARow; // linha final
stringGrid1.Selection:=MyRect;
end; Não conseguí implementar parar quando eu estiver no String2 (ou 1) e começo a descer as linhas,fazer que o outro String role seu ScrollBar para acompanhar um ao outro. Esses códigos postados são eficientes? Uso D7. Obrigado a quem ajudar.
Vtrx
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)