Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Seleccionar celda de StringGrid con botón derecho (https://www.clubdelphi.com/foros/showthread.php?t=66261)

Isuri 10-02-2010 12:02:48

Seleccionar celda de StringGrid con botón derecho
 
Hola,

Me gustaria saber si se puede, y si se puede, cómo seleccionar una celda de un StringGrid con el botón derecho del ratón, ya que al evento OnSelectCell sólo entra cuando seleccionas con el botón izquierdo del ratón.

Gracias.

Caro 10-02-2010 13:02:54

Hola Isuri, utiliza el evento OnMouseDown y el procedimientoMouseToCell:

Código Delphi [-]
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
 Col, Row : Integer;
begin
 if Shift = [ssRight] then //Esto para el Click derecho
  begin
   StringGrid1.MouseToCell(X, Y, Col, Row);
   if (Row<>0) and (Col<>0) then
    begin
     StringGrid1.Row := Row;
     StringGrid1.Col := Col;
    end;
  end;
end;

Saluditos

Isuri 10-02-2010 13:59:13

Muchas gracias Caro, era justo lo que necesitaba!


La franja horaria es GMT +2. Ahora son las 22:56:12.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi