View Issue Details

IDProjectCategoryView StatusLast Update
0020121LazarusLCLpublic2012-02-04 18:40
ReporterFredAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.30.1 (SVN)Product Build 
Target Version1.0.0Fixed in Version0.9.31 (SVN) 
Summary0020121: Carbon - TMaskEdit - wrong keyboard shortcuts
DescriptionTMaskEdit uses Windows or Linux's keyboard shortcuts Ctrl+C,V,X instead of Apple+C,V,X
TagsNo tags attached.
Fixed in Revision35131
LazTarget1.0
WidgetsetCarbon
Attached Files
  • maskedit.shortcutkeys.diff (1,439 bytes)
    Index: lcl/maskedit.pp
    ===================================================================
    --- lcl/maskedit.pp	(revision 31810)
    +++ lcl/maskedit.pp	(working copy)
    @@ -1629,6 +1629,8 @@
     
     // Single key down procedure
     procedure TCustomMaskEdit.KeyDown(var Key: Word; Shift: TShiftState);
    +const
    +  ssModifier = {$if defined(darwin) or defined(macos)} ssMeta {$else} ssCtrl {$endif};
     begin
       Inherited KeyDown(Key, Shift);
       // Not masked -> old procedure
    @@ -1662,7 +1664,7 @@
           begin//Cut
             CutToClipBoard;
           end
    -      else if (Shift = [ssCtrl]) then
    +      else if (Shift = [ssModifier]) then
           begin//Clear
             DeleteSelected;
           end
    @@ -1706,20 +1708,20 @@
             PasteFromClipBoard;
           end;
         end
    -    else if (Shift = [ssCtrl]) then
    +    else if (Shift = [ssModifier]) then
         begin//Copy
           CopyToClipBoard;
         end;
         Key := 0;
         Exit;
       end;
    -  if (Key = VK_C) and (Shift = [ssCtrl]) then
    +  if (Key = VK_C) and (Shift = [ssModifier]) then
       begin//Copy
         CopyToClipBoard;
         Key := 0;
         Exit;
       end;
    -  if (Key = VK_X) and (Shift = [ssCtrl]) then
    +  if (Key = VK_X) and (Shift = [ssModifier]) then
       begin//Cut
         if not ReadOnly then
         begin
    @@ -1728,7 +1730,7 @@
           Exit;
         end;
       end;
    -  if (Key = VK_V) and (Shift = [ssCtrl]) then
    +  if (Key = VK_V) and (Shift = [ssModifier]) then
       begin//Paste
         if not ReadOnly then
         begin
    

Activities

Bart Broersma

2011-09-01 15:31

developer   ~0051355

I thought Ctrl+Key was treated as Cmd+Key in Mac?

2011-09-05 19:02

 

maskedit.shortcutkeys.diff (1,439 bytes)
Index: lcl/maskedit.pp
===================================================================
--- lcl/maskedit.pp	(revision 31810)
+++ lcl/maskedit.pp	(working copy)
@@ -1629,6 +1629,8 @@
 
 // Single key down procedure
 procedure TCustomMaskEdit.KeyDown(var Key: Word; Shift: TShiftState);
+const
+  ssModifier = {$if defined(darwin) or defined(macos)} ssMeta {$else} ssCtrl {$endif};
 begin
   Inherited KeyDown(Key, Shift);
   // Not masked -> old procedure
@@ -1662,7 +1664,7 @@
       begin//Cut
         CutToClipBoard;
       end
-      else if (Shift = [ssCtrl]) then
+      else if (Shift = [ssModifier]) then
       begin//Clear
         DeleteSelected;
       end
@@ -1706,20 +1708,20 @@
         PasteFromClipBoard;
       end;
     end
-    else if (Shift = [ssCtrl]) then
+    else if (Shift = [ssModifier]) then
     begin//Copy
       CopyToClipBoard;
     end;
     Key := 0;
     Exit;
   end;
-  if (Key = VK_C) and (Shift = [ssCtrl]) then
+  if (Key = VK_C) and (Shift = [ssModifier]) then
   begin//Copy
     CopyToClipBoard;
     Key := 0;
     Exit;
   end;
-  if (Key = VK_X) and (Shift = [ssCtrl]) then
+  if (Key = VK_X) and (Shift = [ssModifier]) then
   begin//Cut
     if not ReadOnly then
     begin
@@ -1728,7 +1730,7 @@
       Exit;
     end;
   end;
-  if (Key = VK_V) and (Shift = [ssCtrl]) then
+  if (Key = VK_V) and (Shift = [ssModifier]) then
   begin//Paste
     if not ReadOnly then
     begin

Bart Broersma

2011-09-05 19:04

developer   ~0051477

Unassigning as requested.
Please commit patch.

Dmitry Boyarintsev

2011-09-06 03:30

developer   ~0051497

i'm wondering if the code should be on Widgetset level, rather than LCL.

Bart Broersma

2011-09-07 13:32

developer   ~0051556

@Dmitry: normally I would refrain from using ifdefs in LCL for distinction between widgetsets, but this solution is a one-liner and rather trivial.

The alternative would be to write ws implementation of the KeyDown procedure for all widgetsets (at least 7), and they would be all the smae, except for carbon and cocoa. I wouldn't even know if I should write ws implementations for fpgui ws (where the same problem would exists again, since fpgui is supposed to run on all platforms) and the nogui ws.
This then would seem overkill to me.

Since we want our programs to be platform independent, one could even argue that in Classes (where TShiftStateEnum is define) a constant should be defined that equals ssCtrl on PC's and ssMeta on Mac's.

If you insist I will write ws implementations for android (?), carbon, cocoa, gtk, gtk2, qt, win32 and wince, allthough frankly I have no idea how to do this.

Bart Broersma

2011-09-13 19:58

developer   ~0051796

NB, the same isssue (hardcoding ssCtlr for Copy/Paste) is present in grids.pas.
There are also other examples of using ssCtrl in LCL, where there seesm to be not Mac alternative.
I've also seen several Ctrl+Home and Ctrl+End definitions in KeyDown procedures, whic probably also won't work on a Mac?

Bart Broersma

2011-10-11 10:20

developer   ~0052856

On the mailinglist there is a discussion on how best to achiev something like this: http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-October/067665.html

Bart Broersma

2011-10-12 11:51

developer   ~0052895

Postponing the issue to 1.0.0, awaiting a more generic solution for this issue (see note above).

Felipe Monteiro de Carvalho

2012-02-04 18:39

developer   ~0056479

I added ssModifier to Controls

Issue History

Date Modified Username Field Change
2011-09-01 10:13 Fred New Issue
2011-09-01 10:13 Fred Widgetset => Carbon
2011-09-01 15:31 Bart Broersma Note Added: 0051355
2011-09-01 15:33 Bart Broersma Status new => assigned
2011-09-01 15:33 Bart Broersma Assigned To => Bart Broersma
2011-09-01 15:33 Bart Broersma LazTarget => -
2011-09-01 15:33 Bart Broersma Severity major => minor
2011-09-01 15:33 Bart Broersma Target Version => 1.2.0
2011-09-05 19:02 Bart Broersma File Added: maskedit.shortcutkeys.diff
2011-09-05 19:04 Bart Broersma Note Added: 0051477
2011-09-05 19:04 Bart Broersma Assigned To Bart Broersma =>
2011-09-05 19:04 Bart Broersma Status assigned => confirmed
2011-09-05 19:04 Bart Broersma Target Version 1.2.0 => 0.99.0
2011-09-06 03:30 Dmitry Boyarintsev Note Added: 0051497
2011-09-07 13:32 Bart Broersma Note Added: 0051556
2011-09-13 19:58 Bart Broersma Note Added: 0051796
2011-10-11 00:15 Vincent Snijders LazTarget - => 0.99.0
2011-10-11 10:20 Bart Broersma Note Added: 0052856
2011-10-12 11:51 Bart Broersma Note Added: 0052895
2011-10-12 11:51 Bart Broersma Assigned To => Bart Broersma
2011-10-12 11:51 Bart Broersma Target Version 0.99.0 => 1.0.0
2011-10-12 12:36 Vincent Snijders LazTarget 0.99.0 => 1.0
2011-10-12 17:32 Bart Broersma Status confirmed => assigned
2012-02-04 14:07 Zeljan Rikalo Assigned To Bart Broersma => Felipe Monteiro de Carvalho
2012-02-04 18:39 Felipe Monteiro de Carvalho Fixed in Revision => 35131
2012-02-04 18:39 Felipe Monteiro de Carvalho Status assigned => resolved
2012-02-04 18:39 Felipe Monteiro de Carvalho Fixed in Version => 0.9.31 (SVN)
2012-02-04 18:39 Felipe Monteiro de Carvalho Resolution open => fixed
2012-02-04 18:39 Felipe Monteiro de Carvalho Note Added: 0056479