mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 01:06:02 +02:00
fix cnkeydown to check wm_getdlgcode result
fix win32 intf to also send wm_keydown of cn_keydown wasn't processed git-svn-id: trunk@5616 -
This commit is contained in:
parent
57873bfd7d
commit
0e22eb5e0b
@ -1326,6 +1326,7 @@ type
|
|||||||
procedure SetParentCtl3D(Value : Boolean);
|
procedure SetParentCtl3D(Value : Boolean);
|
||||||
procedure SetUseDockManager(const AValue: Boolean);
|
procedure SetUseDockManager(const AValue: Boolean);
|
||||||
procedure UpdateTabOrder(NewTabValue: TTabOrder);
|
procedure UpdateTabOrder(NewTabValue: TTabOrder);
|
||||||
|
function WantsKey(CharCode: word): dword;
|
||||||
protected
|
protected
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
|
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
|
||||||
@ -2322,6 +2323,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.216 2004/06/29 10:23:00 micha
|
||||||
|
fix cnkeydown to check wm_getdlgcode result
|
||||||
|
fix win32 intf to also send wm_keydown of cn_keydown wasn't processed
|
||||||
|
|
||||||
Revision 1.215 2004/06/28 23:46:40 marc
|
Revision 1.215 2004/06/28 23:46:40 marc
|
||||||
* Fixed compilation on 1.0.10
|
* Fixed compilation on 1.0.10
|
||||||
* Fixed check for override of GetTextBuf and SetTextBuf
|
* Fixed check for override of GetTextBuf and SetTextBuf
|
||||||
|
@ -2079,6 +2079,41 @@ begin
|
|||||||
if Assigned(FOnKeyPress) then FOnKeyPress(Self, Key);
|
if Assigned(FOnKeyPress) then FOnKeyPress(Self, Key);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TWinControl.WantsKey
|
||||||
|
Params: CharCode - the key to inspect whether it is wanted
|
||||||
|
Returns: 0 - if not wanted
|
||||||
|
1 - if wanted, but is special (arrow)
|
||||||
|
2 - if wanted, but is special (tab)
|
||||||
|
4 - if wanted, but is special (all)
|
||||||
|
8 - if wanted, is normal key
|
||||||
|
|
||||||
|
Checks if the passed key is a special key, and if so, returns non zero
|
||||||
|
Also determines type of special key, see return values
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TWinControl.WantsKey(CharCode: word): dword;
|
||||||
|
var
|
||||||
|
lWantKeys: dword;
|
||||||
|
begin
|
||||||
|
// we don't know what keys are special, different widgetsets may have
|
||||||
|
// different set of special keys; send message to control asking
|
||||||
|
// if it wants to handle it, if not, set lWantKeys to zero, so that
|
||||||
|
// KeyDown will not be called
|
||||||
|
lWantKeys := Perform(LM_GETDLGCODE, 0, 0);
|
||||||
|
if (lWantKeys and DLGC_WANTALLKEYS) <> 0 then
|
||||||
|
begin
|
||||||
|
lWantKeys := DLGC_WANTALLKEYS;
|
||||||
|
end else begin
|
||||||
|
case CharCode of
|
||||||
|
VK_TAB:
|
||||||
|
lWantKeys := lWantKeys and DLGC_WANTTAB;
|
||||||
|
VK_UP, VK_LEFT, VK_DOWN, VK_RIGHT:
|
||||||
|
lWantKeys := lWantKeys and DLGC_WANTARROWS;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result := lWantKeys;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TWinControl DoKeyDown }
|
{ TWinControl DoKeyDown }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -2086,6 +2121,7 @@ function TWinControl.DoKeyDown(Var Message: TLMKey): Boolean;
|
|||||||
var
|
var
|
||||||
F: TCustomForm;
|
F: TCustomForm;
|
||||||
ShiftState: TShiftState;
|
ShiftState: TShiftState;
|
||||||
|
lWantsKey: dword;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
F := GetParentForm(Self);
|
F := GetParentForm(Self);
|
||||||
@ -2101,15 +2137,20 @@ begin
|
|||||||
|
|
||||||
// let drag object handle the key
|
// let drag object handle the key
|
||||||
if Dragging and (DragObject<>nil) then
|
if Dragging and (DragObject<>nil) then
|
||||||
|
begin
|
||||||
DragObject.KeyDown(CharCode, ShiftState);
|
DragObject.KeyDown(CharCode, ShiftState);
|
||||||
if CharCode = VK_UNKNOWN then Exit;
|
if CharCode = VK_UNKNOWN then Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
// let user handle the key
|
// let user handle the key
|
||||||
if not (csNoStdEvents in ControlStyle)
|
if not (csNoStdEvents in ControlStyle) then
|
||||||
then begin
|
begin
|
||||||
// ToDo: only If WantAllKeys then
|
lWantsKey := WantsKey(CharCode);
|
||||||
KeyDown(CharCode, ShiftState);
|
if (lWantsKey > 0) and (lWantsKey <= DLGC_WANTALLKEYS) then
|
||||||
if CharCode = VK_UNKNOWN then Exit;
|
begin
|
||||||
|
KeyDown(CharCode, ShiftState);
|
||||||
|
if CharCode = VK_UNKNOWN then Exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// let application handle the key
|
// let application handle the key
|
||||||
@ -3053,10 +3094,15 @@ end;
|
|||||||
event handler.
|
event handler.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TWinControl.WMKeyDown(Var Message : TLMKeyDown);
|
Procedure TWinControl.WMKeyDown(Var Message : TLMKeyDown);
|
||||||
|
var
|
||||||
|
ShiftState: TShiftState;
|
||||||
begin
|
begin
|
||||||
//DebugLn('TWinControl.WMKeyDown ',Name,':',ClassName);
|
//DebugLn('TWinControl.WMKeyDown ',Name,':',ClassName);
|
||||||
// ToDo: If not WantAllKeys then
|
if WantsKey(Message.CharCode) = 8 then
|
||||||
//KeyDown(CharCode, ShiftState);
|
begin
|
||||||
|
ShiftState := KeyDataToShiftState(Message.KeyData);
|
||||||
|
KeyDown(Message.CharCode, ShiftState);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3660,6 +3706,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.244 2004/06/29 10:23:00 micha
|
||||||
|
fix cnkeydown to check wm_getdlgcode result
|
||||||
|
fix win32 intf to also send wm_keydown of cn_keydown wasn't processed
|
||||||
|
|
||||||
Revision 1.243 2004/06/28 18:57:55 mattias
|
Revision 1.243 2004/06/28 18:57:55 mattias
|
||||||
fixed GetControlAtPos for non designing
|
fixed GetControlAtPos for non designing
|
||||||
|
|
||||||
|
@ -565,6 +565,7 @@ Begin
|
|||||||
Assert(False,Format('WM_KEYDOWN KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
Assert(False,Format('WM_KEYDOWN KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
||||||
Assert(False,' OwnerObject= '+TComponent(OwnerObject).Name+':'+OwnerObject.ClassName);
|
Assert(False,' OwnerObject= '+TComponent(OwnerObject).Name+':'+OwnerObject.ClassName);
|
||||||
End;
|
End;
|
||||||
|
WinProcess := false;
|
||||||
End;
|
End;
|
||||||
WM_KEYUP:
|
WM_KEYUP:
|
||||||
Begin
|
Begin
|
||||||
@ -577,6 +578,7 @@ Begin
|
|||||||
CharCode := Word(WParam);
|
CharCode := Word(WParam);
|
||||||
Assert(False,Format('WM_KEYUP KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
Assert(False,Format('WM_KEYUP KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
||||||
End;
|
End;
|
||||||
|
WinProcess := false;
|
||||||
End;
|
End;
|
||||||
WM_KILLFOCUS:
|
WM_KILLFOCUS:
|
||||||
Begin
|
Begin
|
||||||
@ -1037,11 +1039,24 @@ Begin
|
|||||||
WinProcess := true;
|
WinProcess := true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
WM_SETCURSOR:
|
WM_SETCURSOR:
|
||||||
begin
|
begin
|
||||||
if LMessage.Result = 0 then
|
if LMessage.Result = 0 then
|
||||||
WinProcess := true;
|
WinProcess := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
WM_KEYDOWN, WM_KEYUP:
|
||||||
|
begin
|
||||||
|
// if not yet processed, resend normally
|
||||||
|
if LMKey.CharCode <> VK_UNKNOWN then
|
||||||
|
begin
|
||||||
|
LMKey.Msg := Msg;
|
||||||
|
DeliverMessage(OwnerObject, LMKey);
|
||||||
|
// still not handled? then do default processing
|
||||||
|
WinProcess := LMKey.CharCode <> VK_UNKNOWN;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if WinProcess then
|
if WinProcess then
|
||||||
@ -1238,6 +1253,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.121 2004/06/29 10:23:00 micha
|
||||||
|
fix cnkeydown to check wm_getdlgcode result
|
||||||
|
fix win32 intf to also send wm_keydown of cn_keydown wasn't processed
|
||||||
|
|
||||||
Revision 1.120 2004/06/20 20:36:55 micha
|
Revision 1.120 2004/06/20 20:36:55 micha
|
||||||
remove old obsolete/commented toolbutton code
|
remove old obsolete/commented toolbutton code
|
||||||
rename lazarusform classname to window, because we use it for panels, notebookpages, etc too
|
rename lazarusform classname to window, because we use it for panels, notebookpages, etc too
|
||||||
|
Loading…
Reference in New Issue
Block a user