carbon: some fixes for TWinControl.ParentWindow

git-svn-id: trunk@23990 -
This commit is contained in:
paul 2010-03-14 14:43:59 +00:00
parent 75c0134975
commit 62f6cb12cf
2 changed files with 8 additions and 4 deletions

View File

@ -997,9 +997,13 @@ var
begin
Window := LCLObject.GetTopParent;
if (Window is TWinControl) and (Window.Parent = nil) and (TWinControl(Window).ParentWindow <> 0) then
Result := TCarbonControl(TWinControl(Window).ParentWindow).GetTopParentWindow
else
if Window is TCustomForm then
Result := TCarbonWindow((Window as TWinControl).Handle).GetTopParentWindow
else Result := nil;
else
Result := nil;
end;
{------------------------------------------------------------------------------

View File

@ -1281,19 +1281,19 @@ procedure TCarbonWindow.AddToWidget(AParent: TCarbonWidget);
begin
if Assigned(AParent) then
begin
fWindowRef := nil;
fHiddenWin := fWindowRef;
fWindowRef := nil;
if IsWindowVisible(fHiddenWin) then HideWindow(fHiddenWin);
OSError(HIViewAddSubview(AParent.Content, FScrollView), Self, 'AddToWidget', SViewAddView);
AParent.ControlAdded;
SetClientAlign(fScrollView, fWinContent, false);
SetClientAlign(FScrollView, fWinContent, false);
end else begin
if IsVisible then
begin
ShowWindow(fHiddenWin);
OSError(HIViewAddSubview(fWinContent, FScrollView), Self, 'AddToWidget', SViewAddView);
end;
SetClientAlign(fScrollView, fWinContent, true);
SetClientAlign(FScrollView, fWinContent, true);
fWindowRef := fHiddenWin;
end;
end;