mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:19:12 +02:00
MG: fixed unknown special key code
git-svn-id: trunk@298 -
This commit is contained in:
parent
e186a1d1d7
commit
7e73ae43d8
@ -143,7 +143,23 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
function ShowKeyMappingEditForm(Index:integer;
|
function ShowKeyMappingEditForm(Index:integer;
|
||||||
AKeyCommandRelationList:TKeyCommandRelationList):TModalResult;
|
AKeyCommandRelationList:TKeyCommandRelationList):TModalResult;
|
||||||
|
|
||||||
|
procedure InitComboBox(AComboBox: TComboBox; AKey: integer);
|
||||||
|
var s: string;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
s:=KeyAndShiftStateToStr(AKey,[]);
|
||||||
|
i:=AComboBox.Items.IndexOf(s);
|
||||||
|
if i>=0 then
|
||||||
|
AComboBox.ItemIndex:=i
|
||||||
|
else if lowercase(copy(s,1,5))='word(' then begin
|
||||||
|
AComboBox.Items.Add(s);
|
||||||
|
AComboBox.ItemIndex:=AComboBox.Items.IndexOf(s);
|
||||||
|
end else
|
||||||
|
AComboBox.ItemIndex:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if KeyMappingEditForm<>nil then exit;
|
if KeyMappingEditForm<>nil then exit;
|
||||||
@ -159,15 +175,13 @@ begin
|
|||||||
Key1CtrlCheckBox.Checked:=ssCtrl in Shift1;
|
Key1CtrlCheckBox.Checked:=ssCtrl in Shift1;
|
||||||
Key1AltCheckBox.Checked:=ssAlt in Shift1;
|
Key1AltCheckBox.Checked:=ssAlt in Shift1;
|
||||||
Key1ShiftCheckBox.Checked:=ssShift in Shift1;
|
Key1ShiftCheckBox.Checked:=ssShift in Shift1;
|
||||||
Key1KeyComboBox.ItemIndex:=Key1KeyComboBox.Items.IndexOf(
|
InitComboBox(Key1KeyComboBox,Key1);
|
||||||
KeyAndShiftStateToStr(Key1,[]));
|
|
||||||
end;
|
end;
|
||||||
if Key2<>VK_UNKNOWN then begin
|
if Key2<>VK_UNKNOWN then begin
|
||||||
Key2CtrlCheckBox.Checked:=ssCtrl in Shift2;
|
Key2CtrlCheckBox.Checked:=ssCtrl in Shift2;
|
||||||
Key2AltCheckBox.Checked:=ssAlt in Shift2;
|
Key2AltCheckBox.Checked:=ssAlt in Shift2;
|
||||||
Key2ShiftCheckBox.Checked:=ssShift in Shift2;
|
Key2ShiftCheckBox.Checked:=ssShift in Shift2;
|
||||||
Key2KeyComboBox.ItemIndex:=Key1KeyComboBox.Items.IndexOf(
|
InitComboBox(Key2KeyComboBox,Key2);
|
||||||
KeyAndShiftStateToStr(Key2,[]));
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result:=ShowModal;
|
Result:=ShowModal;
|
||||||
@ -770,13 +784,10 @@ end;
|
|||||||
procedure TKeyMappingEditForm.FormKeyUp(Sender: TObject; var Key: Word;
|
procedure TKeyMappingEditForm.FormKeyUp(Sender: TObject; var Key: Word;
|
||||||
Shift:TShiftState);
|
Shift:TShiftState);
|
||||||
begin
|
begin
|
||||||
writeln('TKeyMappingEditForm.FormKeyUp Sender=',Classname
|
//writeln('TKeyMappingEditForm.FormKeyUp Sender=',Classname
|
||||||
,' Key=',Key
|
// ,' Key=',Key,' Ctrl=',ssCtrl in Shift,' Shift=',ssShift in Shift
|
||||||
,' Ctrl=',ssCtrl in Shift
|
// ,' Alt=',ssAlt in Shift,' AsString=',KeyAndShiftStateToStr(Key,Shift)
|
||||||
,' Shift=',ssShift in Shift
|
// );
|
||||||
,' Alt=',ssAlt in Shift
|
|
||||||
,' AsString=',KeyAndShiftStateToStr(Key,Shift)
|
|
||||||
);
|
|
||||||
if Key in [VK_CONTROL, VK_SHIFT, VK_LCONTROL, VK_RCONTROl,
|
if Key in [VK_CONTROL, VK_SHIFT, VK_LCONTROL, VK_RCONTROl,
|
||||||
VK_LSHIFT, VK_RSHIFT] then exit;
|
VK_LSHIFT, VK_RSHIFT] then exit;
|
||||||
if (GrabbingKey in [1,2]) then begin
|
if (GrabbingKey in [1,2]) then begin
|
||||||
|
@ -452,11 +452,15 @@ begin
|
|||||||
GDK_F1..GDK_F24: VirtualKey := VK_F1 + (Event^.KeyVal - GDK_F1);
|
GDK_F1..GDK_F24: VirtualKey := VK_F1 + (Event^.KeyVal - GDK_F1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if VirtualKey=VK_UNKNOWN then
|
if VirtualKey=VK_UNKNOWN then begin
|
||||||
// map all other keys to VK_IRREGULAR +
|
// map all other keys to VK_IRREGULAR + KeyCode
|
||||||
VirtualKey := VK_IRREGULAR + KeyCode;
|
VirtualKey := VK_IRREGULAR + KeyCode;
|
||||||
|
if VirtualKey<VK_IRREGULAR then
|
||||||
|
VirtualKey := VK_IRREGULAR;
|
||||||
|
end;
|
||||||
|
|
||||||
//writeln('GetGTKKeyInfo KeyCode=',KeyCode,' VirtualKey=',VirtualKey
|
//writeln('GetGTKKeyInfo Event^.KeyVal=',Event^.KeyVal,' KeyCode=',KeyCode
|
||||||
|
//,' VirtualKey=',VirtualKey
|
||||||
//,' SysKey=',SysKey,' Extended=',Extended,' Toggle=',Toggle);
|
//,' SysKey=',SysKey,' Extended=',Extended,' Toggle=',Toggle);
|
||||||
|
|
||||||
// Assert(False, Format('Trace:[GetGTKKeyInfo] Event^.KeyVal %d, Event^.State %d, KeyCode %d, VirtualKey %d, SysKey %d, Extended %d, CtrlDown %d', [Integer(Event^.KeyVal), Integer(Event^.State), Integer(KeyCode), Integer(VirtualKey), Integer(SysKey), Integer(Extended), Integer(CtrlDown)]));
|
// Assert(False, Format('Trace:[GetGTKKeyInfo] Event^.KeyVal %d, Event^.State %d, KeyCode %d, VirtualKey %d, SysKey %d, Extended %d, CtrlDown %d', [Integer(Event^.KeyVal), Integer(Event^.State), Integer(KeyCode), Integer(VirtualKey), Integer(SysKey), Integer(Extended), Integer(CtrlDown)]));
|
||||||
@ -740,8 +744,8 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.18 2001/06/20 17:00:20 lazarus
|
Revision 1.19 2001/06/20 17:34:37 lazarus
|
||||||
MG: alternative key bugfix, shiftstate bugfix
|
MG: fixed unknown special key code
|
||||||
|
|
||||||
Revision 1.17 2001/06/20 13:35:51 lazarus
|
Revision 1.17 2001/06/20 13:35:51 lazarus
|
||||||
MG: added VK_IRREGULAR and key grabbing
|
MG: added VK_IRREGULAR and key grabbing
|
||||||
|
Loading…
Reference in New Issue
Block a user