mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 10:59:30 +02:00
let general WindowProc also handle childedit of combobox, reduces code duplication, implements doubleclick for combobox
git-svn-id: trunk@6777 -
This commit is contained in:
parent
cce3ba1e5c
commit
7fc273c941
@ -495,7 +495,20 @@ Begin
|
||||
|
||||
Assert(False, 'Trace:WindowProc - Getting Object With Callback Procedure');
|
||||
WindowInfo := GetWindowInfo(Window);
|
||||
lWinControl := WindowInfo^.WinControl;
|
||||
if WindowInfo^.isChildEdit then
|
||||
begin
|
||||
lWinControl := WindowInfo^.AWinControl;
|
||||
// filter messages we want to pass on to LCL
|
||||
if (Msg <> WM_KILLFOCUS) and (Msg <> WM_SETFOCUS)
|
||||
and ((Msg < WM_KEYFIRST) or (Msg > WM_KEYLAST))
|
||||
and ((Msg < WM_MOUSEFIRST) or (Msg > WM_MOUSELAST)) then
|
||||
begin
|
||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||
exit;
|
||||
end;
|
||||
end else begin
|
||||
lWinControl := WindowInfo^.WinControl;
|
||||
end;
|
||||
Assert(False, 'Trace:WindowProc - Getting Callback Object');
|
||||
|
||||
Assert(False, 'Trace:WindowProc - Checking Proc');
|
||||
@ -1478,90 +1491,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: ChildEditWindowProc
|
||||
Params: Window - The window that receives a message
|
||||
Msg - The message received
|
||||
WParam - Word parameter
|
||||
LParam - Long-integer parameter
|
||||
Returns: 0 if Msg is handled; non-zero long-integer result otherwise
|
||||
|
||||
Handles the messages sent to the edit child of a (combobox, spinedit) control
|
||||
by Windows or other applications
|
||||
------------------------------------------------------------------------------}
|
||||
function ChildEditWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||
LParam: Windows.LParam): LResult; stdcall;
|
||||
var
|
||||
LMessage: TLMessage;
|
||||
LMKey: TLMKey;
|
||||
PLMsg: PLMessage;
|
||||
NotifyUserInput: boolean;
|
||||
WinProcess: boolean;
|
||||
lWinControl: TWinControl;
|
||||
begin
|
||||
// filter messages we want to send to LCL
|
||||
WinProcess := true;
|
||||
if (Msg = WM_KILLFOCUS) or (Msg = WM_SETFOCUS) or
|
||||
((Msg >= WM_KEYFIRST) and (Msg <= WM_KEYLAST)) then
|
||||
begin
|
||||
// TODO: code copied from WindowProc
|
||||
PLMsg := @LMessage;
|
||||
case Msg of
|
||||
WM_KILLFOCUS, WM_SETFOCUS:
|
||||
begin
|
||||
LMessage.Msg := Msg;
|
||||
end;
|
||||
WM_KEYDOWN:
|
||||
begin
|
||||
NotifyUserInput := True;
|
||||
PLMsg:=@LMKey;
|
||||
with LMKey Do
|
||||
begin
|
||||
Msg := CN_KEYDOWN;
|
||||
KeyData := LParam;
|
||||
CharCode := Word(WParam);
|
||||
Assert(False,Format('WM_KEYDOWN KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
||||
end;
|
||||
end;
|
||||
WM_KEYUP:
|
||||
begin
|
||||
NotifyUserInput := True;
|
||||
PLMsg:=@LMKey;
|
||||
with LMKey do
|
||||
begin
|
||||
Msg := CN_KEYUP;
|
||||
KeyData := LParam;
|
||||
CharCode := Word(WParam);
|
||||
Assert(False,Format('WM_KEYUP KeyData= %d CharCode= %d ',[KeyData,CharCode]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// application processing
|
||||
if NotifyUserInput then
|
||||
NotifyApplicationUserInput(PLMsg^.Msg);
|
||||
|
||||
lWinControl := GetWindowInfo(Window)^.AWinControl;
|
||||
DeliverMessage(lWinControl, PLMsg^);
|
||||
|
||||
case Msg of
|
||||
WM_KEYDOWN, WM_KEYUP:
|
||||
begin
|
||||
// if not yet processed, resend normally
|
||||
if LMKey.CharCode <> VK_UNKNOWN then
|
||||
begin
|
||||
LMKey.Msg := Msg;
|
||||
DeliverMessage(lWinControl, LMKey);
|
||||
// still not handled? then do default processing
|
||||
WinProcess := LMKey.CharCode <> VK_UNKNOWN;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if WinProcess then
|
||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Procedure: TimerCallBackProc
|
||||
Params: window_hnd - handle of window for timer message, not set in this implementation
|
||||
@ -1594,6 +1523,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.193 2005/02/10 21:07:29 micha
|
||||
let general WindowProc also handle childedit of combobox, reduces code duplication, implements doubleclick for combobox
|
||||
|
||||
Revision 1.192 2005/02/07 19:10:31 micha
|
||||
revert unwanted commit
|
||||
|
||||
|
@ -197,8 +197,6 @@ function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||
LParam: Windows.LParam): LResult; stdcall;
|
||||
function ComboBoxWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||
LParam: Windows.LParam): LResult; stdcall;
|
||||
function ChildEditWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||
LParam: Windows.LParam): LResult; stdcall;
|
||||
function CallDefaultWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||
LParam: Windows.LParam): LResult;
|
||||
|
||||
@ -286,6 +284,9 @@ End.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.133 2005/02/10 21:07:29 micha
|
||||
let general WindowProc also handle childedit of combobox, reduces code duplication, implements doubleclick for combobox
|
||||
|
||||
Revision 1.132 2005/02/07 16:19:14 micha
|
||||
force default width and height for calendar control
|
||||
|
||||
|
@ -48,6 +48,7 @@ Type
|
||||
hasTabParent: boolean; // has a tabpage as parent, and is winxp themed
|
||||
isTabPage: boolean; // is window of tabpage
|
||||
isComboEdit: boolean; // is buddy of combobox, the edit control
|
||||
isChildEdit: boolean; // is buddy of combobox, the edit control
|
||||
isGroupBox: boolean; // is groupbox, and does not have themed tabpage as parent
|
||||
MaxLength: dword;
|
||||
MouseX, MouseY: word; // noticing spurious WM_MOUSEMOVE messages
|
||||
|
@ -94,8 +94,9 @@ begin
|
||||
// create window
|
||||
FinishCreateWindow(AWinControl, Params, true);
|
||||
// init buddy
|
||||
Params.SubClassWndProc := @ChildEditWindowProc;
|
||||
Params.SubClassWndProc := @WindowProc;
|
||||
WindowCreateInitBuddy(AWinControl, Params);
|
||||
Params.BuddyWindowInfo^.isChildEdit := true;
|
||||
Result := Params.Window;
|
||||
end;
|
||||
|
||||
|
@ -564,8 +564,9 @@ begin
|
||||
// If the style is CBS_DROPDOWNLIST, GetTopWindow returns null,
|
||||
// because the combobox has no edit in that case.
|
||||
if Buddy<>HWND(nil) then begin
|
||||
SubClassWndProc := @ChildEditWindowProc;
|
||||
SubClassWndProc := @WindowProc;
|
||||
WindowCreateInitBuddy(AWinControl, Params);
|
||||
BuddyWindowInfo^.isChildEdit := true;
|
||||
BuddyWindowInfo^.isComboEdit := true;
|
||||
end else BuddyWindowInfo:=nil;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user