mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 15:39:45 +02:00
win32: dont send messages to LCL about internal combobox focus changes (fixes firing OnEnter, OnExit more than once, issue #0007241)
git-svn-id: trunk@14250 -
This commit is contained in:
parent
a5b4f9d12f
commit
85e93e8f14
@ -238,6 +238,7 @@ var
|
|||||||
|
|
||||||
NMHdr: PNMHdr absolute LParam; // used by WM_NOTIFY
|
NMHdr: PNMHdr absolute LParam; // used by WM_NOTIFY
|
||||||
TmpSize: TSize; // used by WM_MEASUREITEM
|
TmpSize: TSize; // used by WM_MEASUREITEM
|
||||||
|
Info: TComboboxInfo;
|
||||||
|
|
||||||
function ShowHideTabPage(NotebookHandle: HWnd; Showing: boolean): integer;
|
function ShowHideTabPage(NotebookHandle: HWnd; Showing: boolean): integer;
|
||||||
var
|
var
|
||||||
@ -1111,6 +1112,20 @@ begin
|
|||||||
begin
|
begin
|
||||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||||
exit;
|
exit;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (Msg = WM_KILLFOCUS) or (Msg = WM_SETFOCUS) then
|
||||||
|
begin
|
||||||
|
// if focus jumps inside combo then no need to notify LCL
|
||||||
|
Info.cbSize := SizeOf(Info);
|
||||||
|
GetComboBoxInfo(lWinControl.Handle, @Info);
|
||||||
|
if (HWND(WParam) = Info.hwndList) or
|
||||||
|
(HWND(WParam) = Info.hwndItem) or
|
||||||
|
(HWND(WParam) = Info.hwndCombo) then
|
||||||
|
begin
|
||||||
|
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
lWinControl := WindowInfo^.WinControl;
|
lWinControl := WindowInfo^.WinControl;
|
||||||
|
@ -351,14 +351,18 @@ const
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
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;
|
||||||
|
var
|
||||||
|
Info: TComboboxInfo;
|
||||||
begin
|
begin
|
||||||
// darn MS: if combobox has edit control, and combobox receives focus, it
|
// darn MS: if combobox has edit control, and combobox receives focus, it
|
||||||
// passes it on to the edit, so it will send a WM_KILLFOCUS; inhibit
|
// passes it on to the edit, so it will send a WM_KILLFOCUS; inhibit
|
||||||
// also don't pass WM_SETFOCUS to the lcl,
|
// also don't pass WM_SETFOCUS to the lcl,
|
||||||
// it will get one from the edit control
|
// it will get one from the edit control
|
||||||
|
|
||||||
|
Info.cbSize := SizeOf(Info);
|
||||||
|
GetComboBoxInfo(Window, @Info);
|
||||||
if ((Msg = WM_KILLFOCUS) or (Msg = WM_SETFOCUS)) and
|
if ((Msg = WM_KILLFOCUS) or (Msg = WM_SETFOCUS)) and
|
||||||
(Windows.GetTopWindow(Window) <> HWND(nil)) then
|
((HWND(WParam) = Info.hwndItem) or (HWND(WParam) = Info.hwndList)) then
|
||||||
begin
|
begin
|
||||||
// continue normal processing, don't send to lcl
|
// continue normal processing, don't send to lcl
|
||||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||||
|
Loading…
Reference in New Issue
Block a user