Ver Mensaje Individual
  #2  
Antiguo 08-02-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
Yo quitaría el menú de la propiedad PopupMenu del ListBox y en el evento OnMouseDown seleccionaría el ítem y mostraría el menú:

Código Delphi [-]
procedure TForm1.ListBox1MouseDown(...);
var
  P: TPoint;
  I: Integer;

begin
  (* si es el botón derecho *)
  if Button = mbRight then
  begin
    P := Point(X, Y);
    I := ListBox1.ItemAtPos(P, true);

    (* si se hizo click sobre algún ítem *)
    if I <> -1 then
    begin
      ListBox1.ItemIndex := I;
      P := ListBox1.ClientToScreen(P);
      PopupMenu1.Popup(P.X, P.Y);
    end;
  end;
end;

// Saludos
Responder Con Cita