Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

listbox : for mouse only

Posted on 2000-04-20
7
Medium Priority
?
154 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 200 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
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!

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

609 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