Solved

listbox : for mouse only

Posted on 2000-04-20
7
143 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

16 Experts available now in Live!

Get 1:1 Help Now