mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 20:40:25 +02:00
LCL: introduced TWSScrollBar.SetKind() to avoid usage of RecreateWnd when changing kind of TScrollBar, because it crashes on 64bit installations.Fixed AV with qt and gtk2 under 64bit
git-svn-id: trunk@30853 -
This commit is contained in:
parent
158cde9b63
commit
01f454abce
@ -86,14 +86,13 @@ begin
|
||||
OldHeight:=Height;
|
||||
Constraints.UpdateInterfaceConstraints;
|
||||
|
||||
// TODO: Remove RecreateWnd
|
||||
if HandleAllocated
|
||||
then RecreateWnd(Self);
|
||||
|
||||
// switch width and height, but not when loading, because we assume that
|
||||
// the lfm contains a consistent combination of kind and (width, height)
|
||||
if (csLoading in ComponentState) then Exit;
|
||||
|
||||
if HandleAllocated then
|
||||
TWSScrollBarClass(WidgetSetClass).SetKind(Self, FKind = sbHorizontal);
|
||||
|
||||
SetBounds(Left,Top,OldHeight,OldWidth);
|
||||
end;
|
||||
|
||||
|
@ -379,14 +379,19 @@ end;
|
||||
|
||||
class procedure TGtk2WSTrackBar.SetOrientation(
|
||||
const ATrackBar: TCustomTrackBar; const AOrientation: TTrackBarOrientation);
|
||||
var
|
||||
B: Boolean;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ATrackBar, 'SetOrientation') then
|
||||
Exit;
|
||||
ATrackBar.Hide;
|
||||
B := ATrackBar.Visible;
|
||||
if B then
|
||||
ATrackBar.Hide;
|
||||
try
|
||||
RecreateWnd(ATrackBar);
|
||||
finally
|
||||
ATrackBar.Show;
|
||||
if B then
|
||||
ATrackBar.Show;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -73,6 +73,7 @@ type
|
||||
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); override;
|
||||
class procedure SetParams(const AScrollBar: TCustomScrollBar); override;
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
@ -2440,6 +2441,24 @@ begin
|
||||
SetCallbacks(Widget, WidgetInfo);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
|
||||
const AIsHorizontal: Boolean);
|
||||
var
|
||||
B: Boolean;
|
||||
begin
|
||||
if not AScrollBar.HandleAllocated then
|
||||
exit;
|
||||
B := AScrollBar.Visible;
|
||||
if B then
|
||||
AScrollBar.Hide;
|
||||
try
|
||||
RecreateWnd(AScrollBar);
|
||||
finally
|
||||
if B then
|
||||
AScrollBar.Show;
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
|
||||
var
|
||||
Range: PGtkRange;
|
||||
|
@ -47,6 +47,7 @@ type
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); override;
|
||||
class procedure SetParams(const AScrollBar: TCustomScrollBar); override;
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
@ -314,6 +315,41 @@ begin
|
||||
Result := TLCLIntfHandle(QtScrollbar);
|
||||
end;
|
||||
|
||||
class procedure TQtWSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
|
||||
const AIsHorizontal: Boolean);
|
||||
var
|
||||
QtScrollBar: TQtScrollBar;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AScrollBar, 'SetKind') then
|
||||
Exit;
|
||||
QtScrollBar := TQtScrollBar(AScrollBar.Handle);
|
||||
QtScrollBar.BeginUpdate;
|
||||
try
|
||||
case AScrollBar.Kind of
|
||||
sbHorizontal:
|
||||
begin
|
||||
if QtScrollBar.getOrientation <> QtHorizontal then
|
||||
QtScrollBar.SetOrientation(QtHorizontal);
|
||||
if QtScrollBar.getInvertedAppereance then
|
||||
QtScrollBar.setInvertedAppereance(False);
|
||||
if QtScrollbar.getInvertedControls then
|
||||
QtScrollBar.setInvertedControls(False);
|
||||
end;
|
||||
sbVertical:
|
||||
begin
|
||||
if QtScrollBar.getOrientation <> QtVertical then
|
||||
QtScrollBar.SetOrientation(QtVertical);
|
||||
if QtScrollBar.getInvertedAppereance then
|
||||
QtScrollBar.setInvertedAppereance(False);
|
||||
if not QtScrollbar.getInvertedControls then
|
||||
QtScrollBar.setInvertedControls(True);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
QtScrollbar.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TQtWSCustomScrollBar.SetParams
|
||||
Params: None
|
||||
@ -323,6 +359,8 @@ class procedure TQtWSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
|
||||
var
|
||||
QtScrollBar: TQtScrollBar;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AScrollBar, 'SetParams') then
|
||||
Exit;
|
||||
QtScrollBar := TQtScrollBar(AScrollBar.Handle);
|
||||
|
||||
QtScrollBar.BeginUpdate;
|
||||
|
@ -54,6 +54,7 @@ type
|
||||
TWSScrollBar = class(TWSWinControl)
|
||||
published
|
||||
class procedure SetParams(const AScrollBar: TCustomScrollBar); virtual;
|
||||
class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); virtual;
|
||||
end;
|
||||
TWSScrollBarClass = class of TWSScrollBar;
|
||||
|
||||
@ -278,6 +279,12 @@ class procedure TWSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
|
||||
const AIsHorizontal: Boolean);
|
||||
begin
|
||||
RecreateWnd(AScrollBar);
|
||||
end;
|
||||
|
||||
{ TWSCustomListBox }
|
||||
|
||||
class function TWSCustomListBox.GetIndexAtXY(
|
||||
|
Loading…
Reference in New Issue
Block a user