Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Combobox Tastatureingabe (https://www.delphipraxis.net/100459-combobox-tastatureingabe.html)

ebber 28. Sep 2007 16:48


Combobox Tastatureingabe
 
Hallo

ich habe in einer Combobox die Tastenkombination Space + Ctrl belegt. Funktioniert so auch, blos es macht zusätzlich in den Text der in der Combobox steht ein Leerzeichen. Kann ich das irgendwie unterbinden ?

Ich habe auch die Taste Enter für die Combobox belegt, aber immer wenn man auf Enter drückt kommt der Windows kleiner fehler Warnton wie auch immer der heist. Kann man da irgendwie die ursprüngliche Belegung überschreiben, oder so was in der Art ?

MfG

Apollonius 28. Sep 2007 17:00

Re: Combobox Tastatureingabe
 
Setze in deiner onKeyPress-/onKeyDown-Methode einfach den Key auf #0 bzw. den Tastencode auf 0.

ebber 28. Sep 2007 17:12

Re: Combobox Tastatureingabe
 
Hallo

an sowas hattest du gedacht ?

Delphi-Quellcode:

      if ssctrl in shift then
             if Key = $20 then
            begin
                   //
                  Key := $0
            end;
Geht irgendwie nicht.

MfG

marabu 28. Sep 2007 18:32

Re: Combobox Tastatureingabe
 
Hallo,

versuche es so:

Delphi-Quellcode:
procedure TDemoForm.ComboBoxKeyPress(Sender: TObject; var Key: Char);
begin
  case Key of
    #32:
    if GetAsyncKeyState(VK_CONTROL) < 0 then
    begin
      Key := #0;
      // ...
    end;
  end;
end;
Grüße vom marabu

ebber 28. Sep 2007 18:46

Re: Combobox Tastatureingabe
 
Danke. So gehts. :thumb:


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:00 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz