mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 04:49:40 +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;
|
||||
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
|
||||
Result:=mrCancel;
|
||||
if KeyMappingEditForm<>nil then exit;
|
||||
@ -159,15 +175,13 @@ begin
|
||||
Key1CtrlCheckBox.Checked:=ssCtrl in Shift1;
|
||||
Key1AltCheckBox.Checked:=ssAlt in Shift1;
|
||||
Key1ShiftCheckBox.Checked:=ssShift in Shift1;
|
||||
Key1KeyComboBox.ItemIndex:=Key1KeyComboBox.Items.IndexOf(
|
||||
KeyAndShiftStateToStr(Key1,[]));
|
||||
InitComboBox(Key1KeyComboBox,Key1);
|
||||
end;
|
||||
if Key2<>VK_UNKNOWN then begin
|
||||
Key2CtrlCheckBox.Checked:=ssCtrl in Shift2;
|
||||
Key2AltCheckBox.Checked:=ssAlt in Shift2;
|
||||
Key2ShiftCheckBox.Checked:=ssShift in Shift2;
|
||||
Key2KeyComboBox.ItemIndex:=Key1KeyComboBox.Items.IndexOf(
|
||||
KeyAndShiftStateToStr(Key2,[]));
|
||||
InitComboBox(Key2KeyComboBox,Key2);
|
||||
end;
|
||||
end;
|
||||
Result:=ShowModal;
|
||||
@ -770,13 +784,10 @@ end;
|
||||
procedure TKeyMappingEditForm.FormKeyUp(Sender: TObject; var Key: Word;
|
||||
Shift:TShiftState);
|
||||
begin
|
||||
writeln('TKeyMappingEditForm.FormKeyUp Sender=',Classname
|
||||
,' Key=',Key
|
||||
,' Ctrl=',ssCtrl in Shift
|
||||
,' Shift=',ssShift in Shift
|
||||
,' Alt=',ssAlt in Shift
|
||||
,' AsString=',KeyAndShiftStateToStr(Key,Shift)
|
||||
);
|
||||
//writeln('TKeyMappingEditForm.FormKeyUp Sender=',Classname
|
||||
// ,' Key=',Key,' Ctrl=',ssCtrl in Shift,' Shift=',ssShift in Shift
|
||||
// ,' Alt=',ssAlt in Shift,' AsString=',KeyAndShiftStateToStr(Key,Shift)
|
||||
// );
|
||||
if Key in [VK_CONTROL, VK_SHIFT, VK_LCONTROL, VK_RCONTROl,
|
||||
VK_LSHIFT, VK_RSHIFT] then exit;
|
||||
if (GrabbingKey in [1,2]) then begin
|
||||
|
@ -452,11 +452,15 @@ begin
|
||||
GDK_F1..GDK_F24: VirtualKey := VK_F1 + (Event^.KeyVal - GDK_F1);
|
||||
end;
|
||||
|
||||
if VirtualKey=VK_UNKNOWN then
|
||||
// map all other keys to VK_IRREGULAR +
|
||||
if VirtualKey=VK_UNKNOWN then begin
|
||||
// map all other keys to 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);
|
||||
|
||||
// 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$
|
||||
Revision 1.18 2001/06/20 17:00:20 lazarus
|
||||
MG: alternative key bugfix, shiftstate bugfix
|
||||
Revision 1.19 2001/06/20 17:34:37 lazarus
|
||||
MG: fixed unknown special key code
|
||||
|
||||
Revision 1.17 2001/06/20 13:35:51 lazarus
|
||||
MG: added VK_IRREGULAR and key grabbing
|
||||
|
Loading…
Reference in New Issue
Block a user