diff --git a/ide/codetemplatesdlg.pas b/ide/codetemplatesdlg.pas index 87e5c2ff3a..5249561a48 100644 --- a/ide/codetemplatesdlg.pas +++ b/ide/codetemplatesdlg.pas @@ -408,12 +408,17 @@ function CodeMacroAddMissingEnd(const Parameter: string; var Line: String; p: TPoint; + CodeBuf: TCodeBuffer; begin Result:=true; Value:=''; Line:=SrcEdit.CurrentLineText; p:=SrcEdit.CursorTextXY; if p.y<1 then exit; + CodeBuf:=SrcEdit.CodeToolsBuffer as TCodeBuffer; + if CodeBuf=nil then exit; + + while (p.y<=SrcEdit.LineCount) do begin Line:=SrcEdit.Lines[p.y-1]; while (p.x<=length(Line)) do begin diff --git a/lcl/include/controlscrollbar.inc b/lcl/include/controlscrollbar.inc index 68ca94d024..263fe76a13 100644 --- a/lcl/include/controlscrollbar.inc +++ b/lcl/include/controlscrollbar.inc @@ -65,7 +65,7 @@ begin if Value = FPosition then exit; - // scroll content of FControl + // scroll logical client area of FControl OldPosition := FPosition; FPosition := Value; if FControl is TScrollingWinControl then diff --git a/lcl/include/scrollingwincontrol.inc b/lcl/include/scrollingwincontrol.inc index cd09a5d8a0..3713cc73f0 100644 --- a/lcl/include/scrollingwincontrol.inc +++ b/lcl/include/scrollingwincontrol.inc @@ -219,6 +219,7 @@ end; procedure TScrollingWinControl.WMHScroll(var Message : TLMHScroll); begin + DebugLn(['TScrollingWinControl.WMHScroll ',dbgsName(Self)]); HorzScrollbar.ScrollHandler(Message); end; diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index a4f865b5cf..1f52704b96 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -28,7 +28,7 @@ {off $DEFINE VerboseAutoSizeCtrlData} {off $DEFINE VerboseMouseBugfix} -{$DEFINE CHECK_POSITION} +{off $DEFINE CHECK_POSITION} {$IFDEF CHECK_POSITION} const CheckPostionClassName = 'xxxTButtonPanel'; const CheckPostionName = 'xxxBakProjTypeRadioGroup'; @@ -36,6 +36,8 @@ const CheckPostionParentName = 'xxxInheritedPage'; function CheckPosition(AControl: TControl): boolean; begin + Result:=true; + exit; Result:=(CompareText(AControl.ClassName,CheckPostionClassName)=0) or (CompareText(AControl.Name,CheckPostionName)=0) or ((AControl.Parent<>nil) @@ -44,7 +46,6 @@ end; {$ENDIF} - {------------------------------------------------------------------------------ Autosizing Helper classes -------------------------------------------------------------------------------} diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index fd1a8170d1..9580df7dfd 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -142,6 +142,71 @@ type class function TWin32WSScrollBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; + + {$IFDEF NewScrollingLayer} + procedure CreateScrollingLayer(ParentH: HWND); + var + Params: TCreateWindowExParams; + begin + // general initialization of Params + with Params do + begin + Flags := WS_CHILD or WS_CLIPSIBLINGS or WS_CLIPCHILDREN; + FlagsEx := 0; + Window := HWND(nil); + Buddy := HWND(nil); + Parent := ParentH; + SubClassWndProc := @WindowProc; + WindowTitle := nil; + StrCaption := 'TWin32WSScrollBox.CreateHandle ScrollLayer'; + WindowTitle := nil; + Height := 50; + Left := 0; + //Parent := AWinControl.Parent; + Top := 0; + Width := 50; + Flags := Flags or WS_VISIBLE; + FlagsEx := FlagsEx or WS_EX_CONTROLPARENT; + end; + // customization of Params + with Params do + begin + pClassName := @ClsName[0]; + SubClassWndProc := nil; + end; + // create window + with Params do + begin + MenuHandle := HMENU(nil); + + Window := CreateWindowEx(FlagsEx, pClassName, WindowTitle, Flags, + Left, Top, Width, Height, Parent, MenuHandle, HInstance, Nil); + + if Window = 0 then + begin + raise exception.create('failed to create win32 sub control, error: '+IntToStr(GetLastError())); + end; + end; + with Params do + begin + if Window <> HWND(Nil) then + begin + // some controls (combobox) immediately send a message upon setting font + {WindowInfo := AllocWindowInfo(Window); + if GetWindowInfo(Parent)^.needParentPaint then + WindowInfo^.needParentPaint := true; + WindowInfo^.WinControl := AWinControl; + if SubClassWndProc <> nil then + WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLong( + Window, GWL_WNDPROC, PtrInt(SubClassWndProc))); + lhFont := GetStockObject(DEFAULT_GUI_FONT) + Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0);} + end; + end; + Result := Params.Window; + end; + {$ENDIF} + var Params: TCreateWindowExParams; begin @@ -159,6 +224,10 @@ begin // create window FinishCreateWindow(AWinControl, Params, false); Result := Params.Window; + + {$IFDEF NewScrollingLayer} + CreateScrollingLayer(Result); + {$ENDIF} end; { TWin32WSScrollingWinControl }