summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-13 21:11:03 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-13 21:11:03 +0000
commitfafe29dcb23bd43047e05ce9683b274701578b53 (patch)
tree19e22e20205c6084eb9f3b4be28eb42dcd2b5cd3 /src/gui
parent6b145ef325e63c94c2472eceeb77bc561acda2d7 (diff)
downloadfpGUI-fafe29dcb23bd43047e05ce9683b274701578b53.tar.xz
* Added some extra sanity checks in TfpgPageControl.
* UI Designer: Started experimental support to edit a PageControl visually in the designer.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fpg_tab.pas15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas
index 3f368774..789d80fb 100644
--- a/src/gui/fpg_tab.pas
+++ b/src/gui/fpg_tab.pas
@@ -60,9 +60,10 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
- property Text: string read GetText write SetText;
property PageIndex: Integer read GetPageIndex write SetPageIndex;
property PageControl: TfpgPageControl read GetPageControl;
+ published
+ property Text: string read GetText write SetText;
end;
@@ -117,6 +118,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AppendTabSheet(ATitle: string): TfpgTabSheet;
+ procedure RemoveTabSheet(ATabSheet: TfpgTabSheet);
property PageCount: Integer read GetPageCount;
property ActivePage: TfpgTabSheet read FActivePage write SetActivePage;
property Pages[AIndex: integer]: TfpgTabSheet read GetPage;
@@ -248,6 +250,8 @@ end;
procedure TfpgPageControl.RemovePage(const APage: TfpgTabSheet);
begin
+ if APage = nil then
+ Exit;
FPages.Remove(APage);
{$Note This still needs to be fixed.}
if APage = FActivePage then
@@ -262,6 +266,8 @@ end;
procedure TfpgPageControl.SetActivePageIndex(const AValue: integer);
begin
+ if FPages.Count = 0 then
+ exit;
if (AValue >= 0) or (AValue < FPages.Count) then
ActivePage := TfpgTabSheet(FPages[AValue]);
end;
@@ -685,6 +691,7 @@ var
lp: integer; // left position
bw: integer; // button width
begin
+// writeln('>> TfpgPageControl.HandleLMouseUp');
h := TfpgTabSheet(FPages.First);
if h = nil then
Exit; //==>
@@ -696,6 +703,7 @@ begin
case TabPosition of
tpTop:
begin
+// writeln(' TabPosition = tpTop');
if (y > FMargin) and (y < ButtonHeight) then
begin
while h <> nil do
@@ -839,5 +847,10 @@ begin
InsertPage(Result);
end;
+procedure TfpgPageControl.RemoveTabSheet(ATabSheet: TfpgTabSheet);
+begin
+ RemovePage(ATabSheet);
+end;
+
end.