Try this

procedure TForm1.ListBox1MouseDown(Sender: TObject; Button:
TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   i : Integer;
   APoint : TPoint;
begin
   APoint.X := X;
   APoint.Y := Y;
   if Button= mbRight then
   begin
        i := ListBox1.ItemAtPos(APoint, True);
      if i > -1 then
      begin
         ListBox1.Selected[i] := True;
         PopupMenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.y);
      end; { i > -1 }
   end; { Button = mbRight }
end;

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John
Sent: Wednesday, 23 July 2003 8:03 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: TListbox

Hi all,

Does anybody know how to select an item from a TListbox with a
right-click,
at the same time as activating the popUpMenu?

TIA,

John

------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
 

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to