Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-09

KeyDown and value of Shift on Mac (Darwin)

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

A question on KeyDown on Mac:

procedure TSomeEditControl.KeyDown(var Key: Word; Shift: TShiftState);
begin
  if (Key = VK_SomeKey) and (Shift = [ssCtrl]) then
  begin// Ctrl+SomeKey
    DoSomething;
    Key := 0;
  end;
end;

This will do fine on PC's and I thought it would work with Cmd+SomeKey on Mac, but is this really the case?
(Actually SomeKey is VK_C, VK_V or VK_X in this case.

If it is not, should I write widgetsetimplementations for all controls that look for Ctrl-key in KeyDown()?

I do not have access to a Mac, so I cannot test this myself.

Bart

Reply by email

Torsten Bonde Christiansen
to Bart
Bart wrote 16 lines
Hi, A question on KeyDown on Mac: procedure TSomeEditControl.KeyDown(var Key: Word; Shift: TShiftState); begin if (Key = VK_SomeKey) and (Shift = [ssCtrl]) then begin// Ctrl+SomeKey DoSomething; Key := 0; end; end; This will do fine on PC's and I thought it would work with Cmd+SomeKey on Mac, but is this really the case? (Actually SomeKey is VK_C, VK_V or VK_X in this case.

I use *ssMeta* for using the Cmd key on a MAC. I think most modern MAC actually have a Ctrl key as well as the Cmd key.

Kind regards
Torsten Bonde Christiansen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110902/80e2f3c3/attachment.html>

Reply by email