Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Boton Derecho sobre TStringGrid (https://www.clubdelphi.com/foros/showthread.php?t=56588)

keys 21-05-2008 16:09:24

Boton Derecho sobre TStringGrid
 
Hola a todos, en un TstringGrid si se pulsa con el boton derecho sobre una celda que no es la activa, esta no se activa (Es decir no cambia el foco) solo cambia si se hace con el boton izquierdo.

Hay alguna forma de hacer que al hacer click con el boton derecho sobre este componente cambie de celda.

Un Saludo y gracias de a todos.

Caro 21-05-2008 16:27:44

Hola keys, puedes usar el evento OnMouseDown del StringGrid y su parametro Shift que te indica si se ha presionado el boton izquierdo o derecho del mouse, tiene mas opciones pero la que te interesa es ssRight.

Código Delphi [-]
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
 Col, Row: Integer;
begin
 if Shift = [ssRight] then
  begin
   StringGrid1.MouseToCell(X, Y, Col, Row);
   StringGrid1.Row := Row;
   StringGrid1.Col := Col;
  end;
end;

Saluditos


La franja horaria es GMT +2. Ahora son las 01:36:11.

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