From 5f696cfe827c53b4d3c7ae23fd5d5f30d490e79b Mon Sep 17 00:00:00 2001 From: micha Date: Sun, 20 Jun 2004 13:58:15 +0000 Subject: [PATCH] fix combobox edit being gray git-svn-id: trunk@5589 - --- lcl/interfaces/win32/win32callback.inc | 44 +++++++++++++------------- lcl/interfaces/win32/win32object.inc | 5 ++- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index aa34971b6a..09cecabdd0 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -403,13 +403,16 @@ Begin End; WM_COMMAND: Begin - if LParam=0 then OwnerObject := GetMenuItemObject {menuitem or shortcut} - else OwnerObject := TObject(GetProp(LParam, 'Wincontrol')); - -// is this for speedbuttons? -// If ((OwnerObject Is TControl) And (Not (OwnerObject Is TButton))) Then -// CallEvent(OwnerObject, TControl(OwnerObject).OnClick, Nil, etNotify) - + if LParam=0 then + begin + OwnerObject := GetMenuItemObject; {menuitem or shortcut} + end else begin + OwnerObject := TObject(GetProp(LParam, 'Wincontrol')); + // buddy controls use 'awincontrol' to designate associated wincontrol + if OwnerObject = nil then + OwnerObject := TObject(GetProp(LParam, 'AWincontrol')); + end; + if OwnerObject is TMenuItem then begin if (Hi(WParam) = 0) or (Hi(WParam) = 1) then @@ -451,21 +454,14 @@ Begin End; WM_CTLCOLORMSGBOX..WM_CTLCOLORSTATIC: Begin - if HWnd(Windows.GetProp(Window, 'Overlay')) = HWnd(LParam) then + MsgObject := TObject(GetProp(LParam, 'Wincontrol')); + if MsgObject is TWinControl then begin - LMessage.Result := Windows.GetStockObject(NULL_BRUSH); - Windows.SetBkMode(HDC(WParam), TRANSPARENT); + Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(TWinControl(MsgObject).Font.Color))); + Windows.SetBkColor(HDC(WParam), Windows.COLORREF(ColorToRGB(TWinControl(MsgObject).Brush.Color))); + LMessage.Result := LResult(TWinControl(MsgObject).Brush.Handle); + // Override default handling WinProcess := false; - end else begin - MsgObject := TObject(GetProp(LParam, 'WinControl')); - if MsgObject is TWinControl then - begin - Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(TWinControl(MsgObject).Font.Color))); - Windows.SetBkColor(HDC(WParam), Windows.COLORREF(ColorToRGB(TWinControl(MsgObject).Brush.Color))); - LMessage.Result := LResult(TWinControl(MsgObject).Brush.Handle); - // Override default handling - WinProcess := false; - end; end; End; WM_COPY: @@ -1088,7 +1084,8 @@ begin end; WM_KEYFIRST..WM_KEYLAST, WM_MOUSEFIRST..WM_MOUSELAST: begin - Windows.PostMessage(TWinControl(Windows.GetProp(Window, 'Wincontrol')).Handle, Msg, WParam, LParam); + // parent of overlay is the form + Windows.PostMessage(Windows.GetParent(Window), Msg, WParam, LParam); end; else Result := CallDefaultWindowProc(Window, Msg, WParam, LParam); @@ -1180,7 +1177,7 @@ begin if NotifyUserInput then NotifyApplicationUserInput(PLMsg^.Msg); - DeliverMessage(TObject(Windows.GetProp(GetParent(Window), 'Wincontrol')), PLMsg^); + DeliverMessage(TObject(Windows.GetProp(Window, 'AWinControl')), PLMsg^); end; Result := CallDefaultWindowProc(Window, Msg, WParam, LParam); @@ -1256,6 +1253,9 @@ end; { $Log$ + Revision 1.119 2004/06/20 13:58:15 micha + fix combobox edit being gray + Revision 1.118 2004/06/19 15:10:04 micha fix spinedit not firing onchange event diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 3259059070..953108c28f 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -2608,7 +2608,7 @@ Begin If Buddy <> HWND(Nil) Then begin Windows.SetProp(Buddy, 'DefWndProc', Windows.SetWindowLong(Buddy, GWL_WNDPROC, LongInt(SubClassWndProc))); - Windows.SetProp(Buddy, 'Wincontrol', dword(Sender)); + Windows.SetProp(Buddy, 'AWincontrol', dword(Sender)); Windows.SendMessage(Buddy, WM_SETFONT, WParam(FMessageFont), 0); end; End @@ -3281,6 +3281,9 @@ End; { $Log$ + Revision 1.212 2004/06/20 13:58:15 micha + fix combobox edit being gray + Revision 1.211 2004/06/20 13:00:04 micha fix groupbox-parent bug condition, use buddy