Archiv für Keyboard
nSonic #152 – Mac – Schaltflächen mit Tastatur bedienen
Samstag, 26. April 2008
Geht es Euch auch so? Ihr arbeitet viel mit bzw. an der Tastatur und ärgert Euch jedesmal ein wenig, wenn mal wieder ein Dialog erscheint und Ihr nun zur Maus greifen müsst um eine Schaltfläche, einen Button, zu drücken.
Das muss aber nicht sein! Man kann die meisten Schaltflächen nämlich auch mit der Tastatur bedienen. Außerdem gibt es eine Einstellung mit der man dann zukünftig alle Schaltflächen (und andere Elemente in Bildschirmmasken) einfach erreichen kann. Wie das geht, das erfahrt Ihr in dieser Folge #152.
Folge in voller Auflösung herunterladen
Get the Flash Player to see this player.
'; var flattr_tag = 'Keyboard,Mac,Maus,Podcast,Tastatur'; var flattr_url = 'http://www.nsonic.de/blog/2008/04/nsonic-152-mac-schaltflachen-mit-tastatur-bedienen/'; var flattr_lng = 'de_DE';Key Codes
Samstag, 12. Mai 2007{ Virtual Keys, Standard Set }
VK_LBUTTON = 1;
VK_RBUTTON = 2;
VK_CANCEL = 3;
VK_MBUTTON = 4; { NOT contiguous with L & RBUTTON }
VK_BACK = 8;
VK_TAB = 9;
VK_CLEAR = 12;
VK_RETURN = 13;
VK_SHIFT = $10;
VK_CONTROL = 17;
VK_MENU = 18;
weiterlesen »
Keys Status
Samstag, 12. Mai 2007const
CapPanel = 1;
NumPanel = 2;
ScrlPanel = 3;
DatePanel = 4;
begin
with StatusBar1 do
begin
if GetKeyState(VK_CAPITAL) <> 0 then
StatusBar1.Panels[CapPanel].Text := ‘ CAP’
else
StatusBar1.Panels[CapPanel].Text := ”;
if GetKeyState(VK_NUMLOCK) <> 0 then
StatusBar1.Panels[NumPanel].Text := ‘ NUM’
else
StatusBar1.Panels[NumPanel].Text := ”;
if GetKeyState(VK_SCROLL) <> 0 then
StatusBar1.Panels[ScrlPanel].Text := ‘ SCRL’
else
StatusBar1.Panels[ScrlPanel].Text := ”;
StatusBar1.Panels[DatePanel].Text := FormatDateTime(‘ mmmm D, YYYYY’, now);
end;
End;
[tags]Delphi, System, Keyboard[/tags]
Simulating a keystroke
Samstag, 12. Mai 2007> I know this a dumb question but how do I make the system think the user
> pressed Enter from somewhere other than the onKeypress or OnKeyDown events?
keybd_Event(VK_RETURN, 0, 0, 0) ;
Sleep(100);
{Key Up}
keybd_Event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
[tags]Delphi, System, Keyboard[/tags]
EasterEggs
Samstag, 12. Mai 2007>
> How to capture ALT+T E A M in a about box?
>
Hi … Set the form’s KeyPreview property to True and then write the
following code :
weiterlesen »
nSonic Homepage
Samstag, 12. Mai 2007> yes, but what is the virtual-key code for ALT+F?
>
There ain’t one, this is a key *combination*, not a single keystroke.
It would require several messages:
wm_syskeydown for VK_MENU (alt)
wm_syskeydown for Ord(‘F’)
wm_syschar for ‘F’
wm_syskeyup for Ord(‘F’),
wm_syskeyup for VM_MENU
The wm_syschar is not required if you use POstMessage instead of
SendMessage. However, it will probably still not work if the receiver
window checks for Alt down with GetKeyState instead of looking at the
Alt bit in the messages lparam, sending these messages does not change
the keystate array. The following procedure fixes this by changing the
array manually:
weiterlesen »