Newsgroups: borland.public.delphi.objectpascal
Von: "Rob" <r...@activitylinksystems.com>
Datum: Fri, 28 Sep 2001 20:50:06 -1000
Lokal: Sa 29 Sep. 2001 08:50
Betreff: Short cut keys doing function without alt
When I give a button a short cut, like the printer button, &Print, I expect
to have to press Alt-P. When I' in an object, like a grid which does not allow editing, and I press the letter P, I get the print button firing. I am trying to trap the keypress(or keydown) in the grid and do something when I press the letter P. I do not want to have the Print button fire. Is there a way to forces this behavior? The keydown fires first and I can do something there, but abort does not keep the focus from moving to the Print button. Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: "Peter Below (TeamB)" <100113.1...@compuXXserve.com>
Datum: Sat, 29 Sep 2001 15:50:25 +0200
Lokal: Sa 29 Sep. 2001 15:50
Betreff: Re: Short cut keys doing function without alt
In article <3bb57583_2@dnews>, Rob wrote: Disabling acelerators without Alt: > When I give a button a short cut, like the printer button, &Print, I expect > to have to press Alt-P. When I' in an object, like a grid which does not > allow editing, and I press the letter P, I get the print button firing. I > am trying to trap the keypress(or keydown) in the grid and do something when > I press the letter P. I do not want to have the Print button fire. Is > there a way to forces this behavior? The keydown fires first and I can do > something there, but abort does not keep the focus from moving to the Print > button. this is nothing specific to a string grid, it is standard Windows To fix this, add a handler for CM_DIALOGCHAR to your form: private procedure TForm1.cmDialogChar( Var msg: TCMDialogChar ); You can also use the forms OnShortcut event to process keys before the Peter Below (TeamB) 100113.1...@compuserve.com) Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: "Rob" <r...@activitylinksystems.com>
Datum: Sat, 29 Sep 2001 08:57:17 -1000
Lokal: Sa 29 Sep. 2001 20:57
Betreff: Re: Short cut keys doing function without alt
Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: "Rob" <r...@activitylinksystems.com>
Datum: Sat, 29 Sep 2001 09:32:40 -1000
Lokal: Sa 29 Sep. 2001 21:32
Betreff: Re: Short cut keys doing function without alt
> If ((msg.keydata and $20000000) = 0) Then I don't understand the (msg.keydata and $20000000). Also, I would like to > msg.result := 1 // alt not down, eat key > Else > inherited; > end; do it in the Onshortcut, as I am not well versed in adding a handler. Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: "Peter Below (TeamB)" <100113.1...@compuXXserve.com>
Datum: Sun, 30 Sep 2001 15:37:56 +0200
Lokal: So 30 Sep. 2001 15:37
Betreff: Re: Short cut keys doing function without alt
In article <3bb621b9$1_1@dnews>, Rob wrote: The CM_DIALOGCHAR message is an "echo" of a WM_CHAR or WM_SYSCHAR message > > If ((msg.keydata and $20000000) = 0) Then > > msg.result := 1 // alt not down, eat key > > Else > > inherited; > > end; > I don't understand the (msg.keydata and $20000000). Windows send to the application in response to a keystroke. Look at the topics for these messages in win32.hlp. You will see that the messages lparam encodes some information about the key (its keyboard scan code for instance) and bit number 29 (counting from 0) in the 32 bit parameter encodes the state of the Alt key. That is what the statement is testing, it performs a bitwise AND of the parameter (which the TWMKey record type cointains in the field named Keydata) with a value that has only the 29th bit set. The result is <> 0 only if the bit was also set in msg.keydata. If you look at SendMessage in win32.hlp you see that a message on the API TMessage = packed record In the 0 case you see the interpretation of parameters and result as 32 bit TWMKey = packed record You can see this as another view of a TMessage record, it has the same total > Also, I would like to Come on, surely you can copy and paste the code from my message <g>. It > do it in the Onshortcut, as I am not well versed in adding a handler. would not be totally straightforward to do the same in OnShortcut. OnShortcut fires in response to a CM_KEYDOWN message (an echo of WM_KEYDOWN or WM_SYSKEYDOWN), so at this point Windows has not yet performed the task of separating keys that create characters from those that do not. Only the former will generate an additional WM_CHAR/WM_SYSCHAR message, which in turn create CM_DIALOGCHAR. We have to detect characters ourselves in OnShortcut, but fortunately there is an API function we can use for that: procedure TForm1.FormShortCut(var Msg: TWMKey; var Handled: Boolean); There is one major difference between using CM_DIALOGCHAR and OnShortcut you Peter Below (TeamB) 100113.1...@compuserve.com) Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: "Rob" <r...@activitylinksystems.com>
Datum: Sun, 30 Sep 2001 19:37:41 -1000
Lokal: Mo 1 Okt. 2001 07:37
Betreff: Re: Short cut keys doing function without alt
Thanks, I think..
"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
Newsgroups: borland.public.delphi.objectpascal
Von: Barry Kelly <dyna...@eircom.net>
Datum: Tue, 02 Oct 2001 16:08:42 +0100
Lokal: Di 2 Okt. 2001 17:08
Betreff: Re: Short cut keys doing function without alt
In article <3bb80155_2@dnews>
"Rob" <r...@activitylinksystems.com> wrote: > Thanks, I think.. Would you mind minimizing the amount of quoted text you include from the previous poster to the least necessary for intelligible continuation of conversation? Thanks. -- Barry -- Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
| ||||||||||||||
| Eine Gruppe erstellen - Google Groups - Google-Startseite - Nutzungsbedingungen - Datenschutzbestimmungen |
| ©2009 Google |