Solved

listbox : for mouse only

Posted on 2000-04-20
7
149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 69
JAudiorecorder record freezing the app 29 82
Delphi Seattle StructureView color 1 21
Browsing a TTreeView in Delphi 5 32
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

763 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