Bart schrieb:
This is a chunk form a proposed patch for TMaskEdit:
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
This is the way I would see it being helpful for cross platform code
for built-in key shortcuts.
You can do it this way, ignoring any platform standards. But this is not
what I expect from a cross-platform library or component.
StandardActions then could benefit from such a ssModifier constant as well.
Another approach might be to have a widgetset function like:
function KeyCombo_IsCut(const Key: Word; const Shift: TShiftState): Boolean
or something like:
type
TCommonShortCut = (tcsUnknown,tcsCut, tcsPaste, tcsCopy, tcsBof, tcsEof);
function KeyComboToCommonShortcut(const Key: Word; const Shift:
TShiftState): TCommonShortCut;
begin
//default to tcsUnKnown;
Result := tcsUnKnown;
...
end;
This comes much closer to my expectations :-)
DoDi
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus