From 4abc2f15e532c32de7e90c4b30e707a61b98fac6 Mon Sep 17 00:00:00 2001 From: micha Date: Wed, 3 Nov 2004 16:32:54 +0000 Subject: [PATCH] fix drawing of listbox, combobox, edit to be non-transparent even in winxp tabpage (fixes black background upon scroll) git-svn-id: trunk@6190 - --- lcl/interfaces/win32/win32callback.inc | 24 +++++++++++------------- lcl/interfaces/win32/win32wsstdctrls.pp | 8 ++++++++ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index a77d0fabf4..536d0c3592 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -538,7 +538,9 @@ Begin // transparently // only static and button controls have transparent parts // others need to erased with their window color - if ((Msg = WM_CTLCOLORSTATIC) or (Msg = WM_CTLCOLORBTN)) then + // scrollbar also has buttons + if (Msg = WM_CTLCOLORSTATIC) or (Msg = WM_CTLCOLORBTN) + or (Msg = WM_CTLCOLORSCROLLBAR) then begin if WindowInfo^.isGroupBox then begin @@ -546,18 +548,11 @@ Begin end else if GetWindowInfo(LParam)^.hasTabParent then begin - // comboboxes send WM_CTLCOLORSTATIC to their parent, but: - // 1) they are opaque, so don't need transparent background - // 2) we will overwrite combobox control, erasing the image! - GetClassName(LParam, winClassName, 10); - if not CompareMem(@winClassName, @ComboboxClsName, High(ComboBoxClsName)+1) then - begin - // need to draw transparently, draw background - GetWin32ControlPos(LParam, Window, P.X, P.Y); - MoveWindowOrgEx(WParam, -P.X, -P.Y); - SendMessage(Window, WM_PAINT, WParam, 0); - MoveWindowOrgEx(WParam, P.X, P.Y); - end; + // need to draw transparently, draw background + GetWin32ControlPos(LParam, Window, P.X, P.Y); + MoveWindowOrgEx(WParam, -P.X, -P.Y); + SendMessage(Window, WM_PAINT, WParam, 0); + MoveWindowOrgEx(WParam, P.X, P.Y); LMessage.Result := GetStockObject(HOLLOW_BRUSH); SetBkMode(WParam, TRANSPARENT); WinProcess := false; @@ -1441,6 +1436,9 @@ end; { $Log$ + Revision 1.153 2004/11/03 16:32:54 micha + fix drawing of listbox, combobox, edit to be non-transparent even in winxp tabpage (fixes black background upon scroll) + Revision 1.152 2004/10/29 18:55:30 micha speed up menu creation diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index ebde66e28c..34cabad463 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -433,6 +433,8 @@ begin end; // create window FinishCreateWindow(AWinControl, Params, false); + // listbox is not a transparent control -> no need for parentpainting + Params.WindowInfo^.hasTabParent := false; Result := Params.Window; end; @@ -586,6 +588,8 @@ begin end; // create window FinishCreateWindow(AWinControl, Params, false); + // combobox is not a transparent control -> no need for parentpainting + Params.WindowInfo^.hasTabParent := false; // get edit window within with Params do begin @@ -761,6 +765,8 @@ begin end; // create window FinishCreateWindow(AWinControl, Params, false); + // edit is not a transparent control -> no need for parentpainting + Params.WindowInfo^.hasTabParent := false; Result := Params.Window; end; @@ -870,6 +876,8 @@ begin end; // create window FinishCreateWindow(AWinControl, Params, false); + // memo is not a transparent control -> no need for parentpainting + Params.WindowInfo^.hasTabParent := false; Result := Params.Window; end;