Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

Disable Key press while in Listbox


      While using a ListBox component, if you press any key, "cursor" jumps to next Item starting with that key letter. For instance, if you press "B", it jumps to first Item starting with "B" letter. How to disable that feature?
0
biber
Asked:
biber
1 Solution
 
erajojCommented:
The easiest way, I think, is to use method onKeyPress.
If you set the referenced "Key" to #0 (char(0)) then
none of the ascii characters typed will work in the listbox.
All other virtual keys (.., VK_UP, VK_DOWN, ...) will work
as they are supposed...

procedure TMainForm.ListBox1KeyPress(Sender: TObject; var Key: Char);
begin
  Key := #0; { Remove all keypresses }
end;

Hope this is what you're looking for!

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now