Solved

listbox : for mouse only

Posted on 2000-04-20
7
151 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

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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