mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 13:39:18 +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');
|
Assert(False, 'Trace:WindowProc - Getting Object With Callback Procedure');
|
||||||
WindowInfo := GetWindowInfo(Window);
|
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 - Getting Callback Object');
|
||||||
|
|
||||||
Assert(False, 'Trace:WindowProc - Checking Proc');
|
Assert(False, 'Trace:WindowProc - Checking Proc');
|
||||||
@ -1478,90 +1491,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
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
|
Procedure: TimerCallBackProc
|
||||||
Params: window_hnd - handle of window for timer message, not set in this implementation
|
Params: window_hnd - handle of window for timer message, not set in this implementation
|
||||||
@ -1594,6 +1523,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
Revision 1.192 2005/02/07 19:10:31 micha
|
||||||
revert unwanted commit
|
revert unwanted commit
|
||||||
|
|
||||||
|
@ -197,8 +197,6 @@ function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
|||||||
LParam: Windows.LParam): LResult; stdcall;
|
LParam: Windows.LParam): LResult; stdcall;
|
||||||
function ComboBoxWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
function ComboBoxWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||||
LParam: Windows.LParam): LResult; stdcall;
|
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;
|
function CallDefaultWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||||
LParam: Windows.LParam): LResult;
|
LParam: Windows.LParam): LResult;
|
||||||
|
|
||||||
@ -286,6 +284,9 @@ End.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.132 2005/02/07 16:19:14 micha
|
||||||
force default width and height for calendar control
|
force default width and height for calendar control
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ Type
|
|||||||
hasTabParent: boolean; // has a tabpage as parent, and is winxp themed
|
hasTabParent: boolean; // has a tabpage as parent, and is winxp themed
|
||||||
isTabPage: boolean; // is window of tabpage
|
isTabPage: boolean; // is window of tabpage
|
||||||
isComboEdit: boolean; // is buddy of combobox, the edit control
|
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
|
isGroupBox: boolean; // is groupbox, and does not have themed tabpage as parent
|
||||||
MaxLength: dword;
|
MaxLength: dword;
|
||||||
MouseX, MouseY: word; // noticing spurious WM_MOUSEMOVE messages
|
MouseX, MouseY: word; // noticing spurious WM_MOUSEMOVE messages
|
||||||
|
@ -94,8 +94,9 @@ begin
|
|||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, true);
|
FinishCreateWindow(AWinControl, Params, true);
|
||||||
// init buddy
|
// init buddy
|
||||||
Params.SubClassWndProc := @ChildEditWindowProc;
|
Params.SubClassWndProc := @WindowProc;
|
||||||
WindowCreateInitBuddy(AWinControl, Params);
|
WindowCreateInitBuddy(AWinControl, Params);
|
||||||
|
Params.BuddyWindowInfo^.isChildEdit := true;
|
||||||
Result := Params.Window;
|
Result := Params.Window;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -564,8 +564,9 @@ begin
|
|||||||
// If the style is CBS_DROPDOWNLIST, GetTopWindow returns null,
|
// If the style is CBS_DROPDOWNLIST, GetTopWindow returns null,
|
||||||
// because the combobox has no edit in that case.
|
// because the combobox has no edit in that case.
|
||||||
if Buddy<>HWND(nil) then begin
|
if Buddy<>HWND(nil) then begin
|
||||||
SubClassWndProc := @ChildEditWindowProc;
|
SubClassWndProc := @WindowProc;
|
||||||
WindowCreateInitBuddy(AWinControl, Params);
|
WindowCreateInitBuddy(AWinControl, Params);
|
||||||
|
BuddyWindowInfo^.isChildEdit := true;
|
||||||
BuddyWindowInfo^.isComboEdit := true;
|
BuddyWindowInfo^.isComboEdit := true;
|
||||||
end else BuddyWindowInfo:=nil;
|
end else BuddyWindowInfo:=nil;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user