Solved

listbox : for mouse only

Posted on 2000-04-20
7
145 Views
Last Modified: 2010-04-04
hi to all,

i have a listbox but it should only work with mouseclicks,
not with keys.
how can i manage it (in D3), that the listbox does not
react on key-events.

thanks
titz
0
Comment
Question by:titz
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
shenqw earned 50 total points
ID: 2735599
procedure TForm1.ListBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  Abort;
end;
0
 

Expert Comment

by:PascalCP
ID: 2735770
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure ListBox1KeyPress(Sender: TObject; var Key: Char);
    procedure OnKeyboard2(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ListBox1KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ListBox1Enter(Sender: TObject);
    procedure OnKeyboardKey(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ListBox1KeyPress(Sender: TObject; var Key: Char);
begin
  exit;
end;

procedure TForm1.ListBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  exit;
end;

procedure TForm1.ListBox1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  exit;
end;

procedure TForm1.ListBox1Enter(Sender: TObject);
begin
  exit;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  exit;
end;

end.
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2735989
My Comment fits in with titz's needs and it's very simple. :))
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:PascalCP
ID: 2738243
You have to put the code in more than one event , otherwise it will not work !
0
 
LVL 1

Author Comment

by:titz
ID: 2738307
hi pascalcp,

what is "onkeyboard2" and "onkeyboardkey" ?

thanks
titz

0
 
LVL 1

Author Comment

by:titz
ID: 2740269
hi pascalcp and shengw,

i tried the suggestion from shengw and it works.
i found out that it is very important to have "abort" and not "exit" in the onkey...-events.
only "abort" in onkeydown and all works so as i wanted it.
therefors the points ar for shengw.
cheers
titz
0
 

Expert Comment

by:PascalCP
ID: 2740526
Hi Shenw,

You are right ! Your solution is much
better .

Kind regards.
PCP
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Thread safe  opinion 7 126
HTML text in the body of an email (delphi code) 12 98
How to define IfThen functions in one common unit? 4 45
CheckListBox usage 3 51
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now