mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 08:20:21 +02:00
carbon: fixed notebook close page, insert page, setpageindex, bug #11719,#11680, #10171
git-svn-id: trunk@15852 -
This commit is contained in:
parent
a87d5a8d4b
commit
4969fb1643
14
ide/main.pp
14
ide/main.pp
@ -6736,9 +6736,8 @@ begin
|
||||
// update marks and cursor positions in Project1, so that merging the old
|
||||
// settings during restoration will work
|
||||
SaveSourceEditorProjectSpecificSettings;
|
||||
SourceNotebook.NewFile(CreateSrcEditPageName(AnUnitInfo.UnitName,
|
||||
NewSrcEdit:=SourceNotebook.NewFile(CreateSrcEditPageName(AnUnitInfo.UnitName,
|
||||
AFilename,-1),AnUnitInfo.Source,false);
|
||||
NewSrcEdit:=SourceNotebook.GetActiveSE;
|
||||
NewSrcEdit.EditorComponent.BeginUpdate;
|
||||
NewSrcEditorCreated:=true;
|
||||
MainIDEBar.itmFileClose.Enabled:=True;
|
||||
@ -6769,7 +6768,8 @@ begin
|
||||
if (not (ofProjectLoading in Flags)) and NewSrcEditorCreated then
|
||||
Project1.InsertEditorIndex(SourceNotebook.Notebook.PageIndex);
|
||||
AnUnitInfo.EditorIndex:=SourceNotebook.FindPageWithEditor(NewSrcEdit);
|
||||
|
||||
//debugln(['TMainIDE.DoOpenFileInSourceEditor ',AnUnitInfo.Filename,' ',AnUnitInfo.EditorIndex]);
|
||||
|
||||
// restore source editor settings
|
||||
DoRestoreBookMarks(AnUnitInfo,NewSrcEdit);
|
||||
DebugBoss.DoRestoreDebuggerMarks(AnUnitInfo);
|
||||
@ -7234,7 +7234,6 @@ var
|
||||
ReOpen, Handled:boolean;
|
||||
NewUnitInfo:TUnitInfo;
|
||||
NewBuf: TCodeBuffer;
|
||||
OtherUnitIndex: Integer;
|
||||
FilenameNoPath: String;
|
||||
LoadBufferFlags: TLoadBufferFlags;
|
||||
DiskFilename: String;
|
||||
@ -7364,13 +7363,6 @@ begin
|
||||
if (not (ofRevert in Flags)) then begin
|
||||
UnitIndex:=Project1.IndexOfFilename(AFilename);
|
||||
ReOpen:=(UnitIndex>=0);
|
||||
// check if there is already a symlinked file open in the editor
|
||||
OtherUnitIndex:=Project1.IndexOfFilename(AFilename,
|
||||
[pfsfOnlyEditorFiles]);
|
||||
if (OtherUnitIndex>=0) and (OtherUnitIndex<>UnitIndex) then begin
|
||||
// There is another file open in the editor symlinked to the same file
|
||||
// ToDo
|
||||
end;
|
||||
if ReOpen then begin
|
||||
NewUnitInfo:=Project1.Units[UnitIndex];
|
||||
if (ofAddToProject in Flags) and (not NewUnitInfo.IsPartOfProject) then
|
||||
|
@ -715,8 +715,8 @@ type
|
||||
procedure StartShowCodeHelp;
|
||||
|
||||
// new, close, focus
|
||||
procedure NewFile(const NewShortName: String; ASource: TCodeBuffer;
|
||||
FocusIt: boolean);
|
||||
function NewFile(const NewShortName: String; ASource: TCodeBuffer;
|
||||
FocusIt: boolean): TSourceEditor;
|
||||
procedure CloseFile(PageIndex:integer);
|
||||
procedure FocusEditor;
|
||||
|
||||
@ -4377,10 +4377,12 @@ Begin
|
||||
{$ENDIF}
|
||||
Result := TSourceEditor.Create(Self,Notebook.Page[PageNum]);
|
||||
Result.EditorComponent.BeginUpdate;
|
||||
//debugln(['TSourceNotebook.NewSE PageNum=',PageNum,' Notebook.PageIndex=',Notebook.PageIndex,' FindPageWithEditor=',FindPageWithEditor(Result)]);
|
||||
|
||||
FSourceEditorList.Add(Result);
|
||||
Result.CodeTemplates:=CodeTemplateModul;
|
||||
Notebook.PageIndex := Pagenum;
|
||||
//debugln(['TSourceNotebook.NewSE C GetActiveSE=Result=',GetActiveSE=Result]);
|
||||
Result.FPageName:=NoteBook.Pages[Pagenum];
|
||||
Result.EditorComponent.BookMarkOptions.BookmarkImages :=
|
||||
SourceEditorMarks.ImgList;
|
||||
@ -5639,25 +5641,23 @@ begin
|
||||
BookMarkGoTo(Value);
|
||||
End;
|
||||
|
||||
Procedure TSourceNotebook.NewFile(const NewShortName: String;
|
||||
ASource: TCodeBuffer; FocusIt: boolean);
|
||||
Var
|
||||
TempEditor: TSourceEditor;
|
||||
function TSourceNotebook.NewFile(const NewShortName: String;
|
||||
ASource: TCodeBuffer; FocusIt: boolean): TSourceEditor;
|
||||
Begin
|
||||
//create a new page
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] A ');
|
||||
{$ENDIF}
|
||||
Visible:=true;
|
||||
TempEditor := NewSE(-1);
|
||||
Result := NewSE(-1);
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] B ');
|
||||
{$ENDIF}
|
||||
TempEditor.CodeBuffer:=ASource;
|
||||
Result.CodeBuffer:=ASource;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] D ');
|
||||
{$ENDIF}
|
||||
TempEditor.PageName:=FindUniquePageName(NewShortName,Notebook.PageIndex);
|
||||
Result.PageName:=FindUniquePageName(NewShortName,Notebook.PageIndex);
|
||||
if FocusIt then FocusEditor;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] end');
|
||||
@ -5674,20 +5674,22 @@ begin
|
||||
{$ENDIF}
|
||||
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
||||
if TempEditor=nil then exit;
|
||||
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.PageIndex]);
|
||||
Visible:=true;
|
||||
EndIncrementalFind;
|
||||
TempEditor.Close;
|
||||
TempEditor.Free;
|
||||
if Notebook.PageCount>1 then
|
||||
begin
|
||||
//writeln('TSourceNotebook.CloseFile B PageIndex=',PageIndex);
|
||||
//writeln('TSourceNotebook.CloseFile B PageIndex=',PageIndex,' Notebook.PageIndex=',Notebook.PageIndex);
|
||||
// if this is the current page, switch to right PageIndex (if possible)
|
||||
if (Notebook.PageIndex = PageIndex) then
|
||||
Notebook.PageIndex := PageIndex +
|
||||
IfThen(PageIndex + 1 < Notebook.PageCount, 1, -1);
|
||||
// delete the page
|
||||
//writeln('TSourceNotebook.CloseFile C PageIndex=',PageIndex,' Notebook.PageCount=',Notebook.PageCount,' NoteBook.PageIndex=',Notebook.PageIndex);
|
||||
Notebook.Pages.Delete(PageIndex);
|
||||
//writeln('TSourceNotebook.CloseFile C PageIndex=',PageIndex,' Notebook.PageCount=',Notebook.PageCount);
|
||||
//writeln('TSourceNotebook.CloseFile D PageIndex=',PageIndex,' Notebook.PageCount=',Notebook.PageCount,' NoteBook.PageIndex=',Notebook.PageIndex);
|
||||
UpdateStatusBar;
|
||||
// set focus to new editor
|
||||
TempEditor:=FindSourceEditorWithPageIndex(Notebook.PageIndex);
|
||||
@ -5695,9 +5697,9 @@ begin
|
||||
TempEditor.EditorComponent.SetFocus;
|
||||
end else
|
||||
begin
|
||||
//writeln('TSourceNotebook.CloseFile D PageIndex=',PageIndex);
|
||||
Notebook.Free;
|
||||
//writeln('TSourceNotebook.CloseFile E PageIndex=',PageIndex);
|
||||
Notebook.Free;
|
||||
//writeln('TSourceNotebook.CloseFile F PageIndex=',PageIndex);
|
||||
Notebook:=nil;
|
||||
Hide;
|
||||
end;
|
||||
|
@ -42,9 +42,10 @@ type
|
||||
{ TCustomPage }
|
||||
|
||||
TPageFlag = (
|
||||
pfAdded, // page handle added to notebook handle
|
||||
pfAdding, // currently page handle adding to notebook handle
|
||||
pfRemoving
|
||||
pfHandleAdded, // page handle added to notebook handle
|
||||
pfHandleAdding, // currently page handle adding to notebook handle
|
||||
pfHandleRemoving,
|
||||
pfAdding
|
||||
);
|
||||
TPageFlags = set of TPageFlag;
|
||||
|
||||
|
@ -36,9 +36,13 @@ end;
|
||||
procedure TNBPages.PageListChange(Ptr: Pointer; AnAction: TListNotification);
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TNBPages.PageListChange(Ptr: Pointer; AnAction: TListNotification);
|
||||
var
|
||||
APage: TCustomPage;
|
||||
begin
|
||||
if (AnAction=lnAdded) then begin
|
||||
(TObject(Ptr) as TCustomPage).Parent:=fNotebook;
|
||||
APage:=TObject(Ptr) as TCustomPage;
|
||||
if not (pfAdding in APage.FFlags) then
|
||||
APage.Parent:=fNotebook;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -248,7 +252,7 @@ begin
|
||||
fAddingPages:=true;
|
||||
for i := 0 to FPageList.Count -1 do begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNotebook.DoCreateWnd ',dbgsName(Self),' Page.Caption=',Page[i].Caption,' pfAdded=',pfAdded in Page[i].Flags]);
|
||||
DebugLn(['TCustomNotebook.DoCreateWnd ',dbgsName(Self),' Page.Caption=',Page[i].Caption,' pfHandleAdded=',pfHandleAdded in Page[i].Flags]);
|
||||
{$ENDIF}
|
||||
lPage := Page[i];
|
||||
AddRemovePageHandle(lPage);
|
||||
@ -444,6 +448,7 @@ procedure TCustomNotebook.InsertPage(APage: TCustomPage; Index: Integer);
|
||||
var
|
||||
NewZPosition: integer;
|
||||
begin
|
||||
if FPageList.IndexOf(APage)>=0 then exit;
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNotebook.InsertPage A ',dbgsName(Self),' Index=',Index,' Name=',
|
||||
APage.Name,' Caption=',APage.Caption]);
|
||||
@ -454,7 +459,9 @@ begin
|
||||
NewZPosition:=GetControlIndex(TCustomPage(fPageList[Index]))
|
||||
else
|
||||
NewZPosition:=-1;
|
||||
Include(APage.FFlags,pfAdding);
|
||||
FPageList.Insert(Index,APage);
|
||||
Exclude(APage.FFlags,pfAdding);
|
||||
APage.Parent := Self;
|
||||
if NewZPosition>=0 then
|
||||
SetControlIndex(APage,NewZPosition);
|
||||
@ -532,13 +539,13 @@ var
|
||||
RealIndex: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
//DebugLn(['TCustomNotebook.WSMovePage APage=',DbgSName(APage),' NewIndex=',NewIndex,' pfAdded=',pfAdded in APage.FFlags]);
|
||||
if HandleAllocated and (pfAdded in APage.FFlags) then begin
|
||||
//DebugLn(['TCustomNotebook.WSMovePage APage=',DbgSName(APage),' NewIndex=',NewIndex,' pfHandleAdded=',pfHandleAdded in APage.FFlags]);
|
||||
if HandleAllocated and (pfHandleAdded in APage.FFlags) then begin
|
||||
RealIndex:=0;
|
||||
i:=0;
|
||||
repeat
|
||||
if (i=NewIndex) or (i=PageCount) then break;
|
||||
if pfAdded in Page[i].FFlags then inc(RealIndex);
|
||||
if pfHandleAdded in Page[i].FFlags then inc(RealIndex);
|
||||
inc(i);
|
||||
until false;
|
||||
//DebugLn(['TCustomNotebook.WSMovePage APage=',DbgSName(APage),' NewIndex=',NewIndex,' RealIndex=',RealIndex]);
|
||||
@ -551,24 +558,24 @@ begin
|
||||
if (not (csDestroying in APage.ComponentState))
|
||||
and (APage.TabVisible or (csDesigning in ComponentState)) then begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle ADD ',DbgSName(APage),' pfAdded=',pfAdded in APage.FFlags]);
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle ADD ',DbgSName(APage),' pfHandleAdded=',pfHandleAdded in APage.FFlags]);
|
||||
{$ENDIF}
|
||||
if (pfAdded in APage.FFlags) then exit;
|
||||
Include(APage.FFlags,pfAdding);
|
||||
if (pfHandleAdded in APage.FFlags) then exit;
|
||||
Include(APage.FFlags,pfHandleAdding);
|
||||
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, APage.VisibleIndex);
|
||||
APage.FFlags:=APage.FFlags+[pfAdded]-[pfAdding];
|
||||
APage.FFlags:=APage.FFlags+[pfHandleAdded]-[pfHandleAdding];
|
||||
APage.ResizeDelayedAutoSizeChildren
|
||||
end else begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle REMOVE ',DbgSName(APage),' pfAdded=',pfAdded in APage.FFlags]);
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle REMOVE ',DbgSName(APage),' pfHandleAdded=',pfHandleAdded in APage.FFlags]);
|
||||
{$ENDIF}
|
||||
if not (pfAdded in APage.FFlags) or (pfRemoving in APage.FFlags) then
|
||||
if not (pfHandleAdded in APage.FFlags) or (pfHandleRemoving in APage.FFlags) then
|
||||
exit;
|
||||
APage.FFlags := APage.FFlags - [pfAdded] + [pfRemoving];
|
||||
APage.FFlags := APage.FFlags - [pfHandleAdded] + [pfHandleRemoving];
|
||||
TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, APage.VisibleIndex);
|
||||
if APage.HandleAllocated then
|
||||
APage.DestroyHandle;
|
||||
Exclude(APage.FFlags, pfRemoving);
|
||||
Exclude(APage.FFlags, pfHandleRemoving);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -102,12 +102,12 @@ var
|
||||
ParentNotebook: TCustomNotebook;
|
||||
i: integer;
|
||||
begin
|
||||
if AParent=Parent then exit;
|
||||
if (AParent=Parent) or (pfAdding in FFlags) then exit;
|
||||
CheckNewParent(AParent);
|
||||
OldParent:=Parent;
|
||||
if (OldParent<>AParent) and (OldParent<>nil)
|
||||
and (OldParent is TCustomNotebook)
|
||||
and (not (pfRemoving in FFlags)) then begin
|
||||
and (not (pfHandleRemoving in FFlags)) then begin
|
||||
// remove from old pagelist
|
||||
ParentNotebook := TCustomNotebook(OldParent);
|
||||
i := PageIndex;
|
||||
@ -122,11 +122,8 @@ begin
|
||||
// add to new pagelist
|
||||
ParentNotebook:=TCustomNotebook(Parent);
|
||||
i:=ParentNotebook.PageList.IndexOf(Self);
|
||||
if i>=0 then
|
||||
ParentNotebook.PageList.Delete(i)
|
||||
else
|
||||
i:=ParentNotebook.PageCount;
|
||||
ParentNotebook.InsertPage(Self,i);
|
||||
if i<0 then
|
||||
ParentNotebook.InsertPage(Self,ParentNotebook.PageCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -203,7 +200,7 @@ end;
|
||||
procedure TCustomPage.DestroyHandle;
|
||||
begin
|
||||
inherited DestroyHandle;
|
||||
Exclude(FFlags,pfAdded);
|
||||
Exclude(FFlags,pfHandleAdded);
|
||||
end;
|
||||
|
||||
function TCustomPage.IsControlVisible: Boolean;
|
||||
@ -248,7 +245,7 @@ end;
|
||||
|
||||
function TCustomPage.AutoSizeDelayed: boolean;
|
||||
begin
|
||||
Result:=(not (pfAdded in FFlags)) or (inherited AutoSizeDelayed);
|
||||
Result:=(not (pfHandleAdded in FFlags)) or (inherited AutoSizeDelayed);
|
||||
end;
|
||||
|
||||
// included by extctrls.pp
|
||||
|
@ -75,6 +75,7 @@ type
|
||||
FNextArrow: ControlRef;
|
||||
FScrollingLeftTimer: TTimer;
|
||||
FScrollingRightTimer: TTimer;
|
||||
FLockChangeEvent: integer;
|
||||
function GetPrevArrowBounds(const R: TRect): TRect;
|
||||
function GetNextArrowBounds(const R: TRect): TRect;
|
||||
procedure ScrollingLeftTimer(Sender: TObject);
|
||||
@ -88,12 +89,14 @@ type
|
||||
procedure UpdateTabs(EnsureLastVisible: Boolean = False; UpdateIndex: Boolean = True);
|
||||
procedure UpdateTabIndex;
|
||||
procedure Remove(ATab: TCarbonTab);
|
||||
function GetControlTabIndex: Integer;
|
||||
function GetControlTabIndex: Integer; // visible index, without hidden or scrolled tabs
|
||||
function GetTabIndex(APageIndex: Integer): Integer;
|
||||
function TabIndexToPageIndex(AIndex: Integer): Integer;
|
||||
public
|
||||
class function GetValidEvents: TCarbonControlEvents; override;
|
||||
procedure ValueChanged; override;
|
||||
procedure DisableChangeEvent;
|
||||
procedure EnableChangeEvent;
|
||||
public
|
||||
function GetClientRect(var ARect: TRect): Boolean; override;
|
||||
function SetBounds(const ARect: TRect): Boolean; override;
|
||||
@ -587,7 +590,13 @@ end;
|
||||
procedure TCarbonTabsControl.UpdateTabIndex;
|
||||
begin
|
||||
// set tab index
|
||||
SetControl32BitValue(ControlRef(Widget), GetControlTabIndex);
|
||||
//debugln(['TCarbonTabsControl.UpdateTabIndex FFirstIndex=',FFirstIndex,' FLastIndex=',FLastIndex,' TabIndex=',FTabIndex]);
|
||||
DisableChangeEvent;
|
||||
try
|
||||
SetControl32BitValue(ControlRef(Widget), GetControlTabIndex);
|
||||
finally
|
||||
EnableChangeEvent;
|
||||
end;
|
||||
Invalidate;
|
||||
ShowTab;
|
||||
end;
|
||||
@ -599,8 +608,12 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonTabsControl.Remove(ATab: TCarbonTab);
|
||||
begin
|
||||
// FTabs is a TObjectLisy and Remove frees the ATab, which will
|
||||
// automatically call this proc again. Check if ATab is already removed.
|
||||
if FTabs.IndexOf(ATab)<0 then exit;
|
||||
FTabs.Remove(ATab);
|
||||
UpdateTabs(False, False);
|
||||
//debugln(['TCarbonTabsControl.Remove ',GetControlTabIndex,' FFirstIndex=',FFirstIndex,' FTabIndex=',FTabIndex,' Count=',ftabs.Count]);
|
||||
end;
|
||||
|
||||
function TCarbonTabsControl.GetControlTabIndex: Integer;
|
||||
@ -609,6 +622,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCarbonTabsControl.GetTabIndex(APageIndex: Integer): Integer;
|
||||
// find the index in FTabs with TCustomPage.PageIndex=APageIndex
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
@ -659,6 +673,7 @@ var
|
||||
NMHdr: TNMHDR;
|
||||
Index, PIndex: Integer;
|
||||
begin
|
||||
if FLockChangeEvent>0 then exit;
|
||||
Index := GetValue - 1;
|
||||
if Index >= 0 then Inc(Index, FFirstIndex);
|
||||
|
||||
@ -707,6 +722,16 @@ begin
|
||||
DeliverMessage(LCLObject, Msg);
|
||||
end;
|
||||
|
||||
procedure TCarbonTabsControl.DisableChangeEvent;
|
||||
begin
|
||||
inc(FLockChangeEvent);
|
||||
end;
|
||||
|
||||
procedure TCarbonTabsControl.EnableChangeEvent;
|
||||
begin
|
||||
dec(FLockChangeEvent);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonTabsControl.GetClientRect
|
||||
Params: ARect - Record for client area coordinates
|
||||
@ -832,11 +857,13 @@ end;
|
||||
procedure TCarbonTabsControl.Add(ATab: TCarbonTab; AIndex: Integer);
|
||||
begin
|
||||
//DebugLn('TCarbonTabsControl.Add ' + DbgS(AIndex));
|
||||
if FTabs.IndexOf(ATab) < 0 then
|
||||
FTabs.Insert(AIndex, ATab);
|
||||
if FTabs.IndexOf(ATab) >= 0 then exit;
|
||||
FTabs.Insert(AIndex, ATab);
|
||||
ATab.Attach(Self);
|
||||
|
||||
UpdateTabs;
|
||||
// sync PageIndex with LCL
|
||||
SetPageIndex(TCustomNotebook(LCLObject).PageIndex);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -848,6 +875,8 @@ end;
|
||||
procedure TCarbonTabsControl.Remove(AIndex: Integer);
|
||||
begin
|
||||
Remove(FTabs[AIndex] as TCarbonTab);
|
||||
// sync PageIndex with LCL
|
||||
SetPageIndex(TCustomNotebook(LCLObject).PageIndex);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -860,26 +889,34 @@ procedure TCarbonTabsControl.SetPageIndex(AIndex: Integer);
|
||||
var
|
||||
ATabIndex: Integer;
|
||||
begin
|
||||
ATabIndex := GetTabIndex(AIndex);
|
||||
DisableChangeEvent;
|
||||
try
|
||||
ATabIndex := GetTabIndex(AIndex);
|
||||
|
||||
//DebugLn('TCarbonTabsControl.SetPageIndex Page: ' + DbgS(AIndex) + ' Tab: ' + DbgS(ATabIndex));
|
||||
//DebugLn('TCarbonTabsControl.SetPageIndex Page: ' + DbgS(AIndex) + ' Tab: ' + DbgS(ATabIndex));
|
||||
|
||||
if (ATabIndex < 0) or (ATabIndex >= FTabs.Count) then
|
||||
begin
|
||||
ATabIndex := -1;
|
||||
SetControl32BitValue(ControlRef(Widget), 0);
|
||||
ShowTab;
|
||||
Exit;
|
||||
if (ATabIndex < 0) or (ATabIndex >= FTabs.Count) then
|
||||
begin
|
||||
// this PageIndex does not exist. This should only happen if AIndex<0
|
||||
if AIndex>=0 then
|
||||
debugln(['TCarbonTabsControl.SetPageIndex unknown pageindex: ',AIndex]);
|
||||
ATabIndex := -1;
|
||||
SetControl32BitValue(ControlRef(Widget), 0);
|
||||
ShowTab;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
FTabIndex := ATabIndex;
|
||||
if (ATabIndex < FFirstIndex) or (ATabIndex > FLastIndex) then
|
||||
begin
|
||||
FFirstIndex := ATabIndex;
|
||||
UpdateTabs;
|
||||
end
|
||||
else
|
||||
UpdateTabIndex;
|
||||
finally
|
||||
EnableChangeEvent;
|
||||
end;
|
||||
|
||||
FTabIndex := ATabIndex;
|
||||
if (ATabIndex < FFirstIndex) or (ATabIndex > FLastIndex) then
|
||||
begin
|
||||
FFirstIndex := ATabIndex;
|
||||
UpdateTabs;
|
||||
end
|
||||
else
|
||||
UpdateTabIndex;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user