Ver Mensaje Individual
  #4  
Antiguo 06-01-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Creo que esto te puede funcionar. En el evento OnMouseDown del ListBox pones:

Código Delphi [-]
var
  Pt: TPoint;
  Index: Integer;

begin
  // Determinar si es el botón derecho
  if Button = mbRight then
  begin
    // Buscar el índice del elemento bajo el cursor del ratón
    Pt := Point(X, Y);
    Index := ListBox1.ItemAtPos(Pt, true);

    // Si hay elemento bajo el cursor...
    if Index <> -1 then
    begin
      // Seleccionarlo
      ListBox1.ItemIndex := Index;

      // y mostrar el menú
      Pt := ListBox1.ClientToScreen(Pt);
      PopupMenu1.Popup(Pt.X, Pt.Y);
    end;
  end;
end;

// Saludos
Responder Con Cita