diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-03-24 17:26:53 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-03-24 17:26:53 +0200 |
commit | 70e81f4afe721178aadafb7d8241585e9d14627d (patch) | |
tree | 97c30a70e7ae3e2d71172d92c871819ba3344b23 /src/gui/fpg_tab.pas | |
parent | 704f5acdcabaddd7567c3eb3d3506b2516bba301 (diff) | |
download | fpGUI-70e81f4afe721178aadafb7d8241585e9d14627d.tar.xz |
tabs: OnChange even is automatically fired when ActivePage is set.
Before this was a manual process. But if the ActivePage was set programatically,
the event never fired. This is now fixed.
I also changed the internal DoChange event to DoPageChanged - it's now a
bit more descriptive.
Diffstat (limited to 'src/gui/fpg_tab.pas')
-rw-r--r-- | src/gui/fpg_tab.pas | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas index 8f3e39af..858dfbd0 100644 --- a/src/gui/fpg_tab.pas +++ b/src/gui/fpg_tab.pas @@ -112,7 +112,7 @@ type procedure SetSortPages(const AValue: boolean); procedure SetStyle(const AValue: TfpgTabStyle); procedure SetTabPosition(const AValue: TfpgTabPosition); - procedure DoChange(ATabSheet: TfpgTabSheet); + procedure DoPageChange(ATabSheet: TfpgTabSheet); function DrawTab(const rect: TfpgRect; const Selected: Boolean = False; const Mode: Integer = 1): TfpgRect; protected procedure OrderSheets; // currently using bubblesort @@ -332,6 +332,7 @@ begin if AValue <> nil then FActivePageIndex := FPages.IndexOf(AValue); RePaint; + DoPageChange(FActivePage); end; function TfpgPageControl.MaxButtonWidthSum: integer; @@ -497,8 +498,12 @@ begin RePaint; end; -procedure TfpgPageControl.DoChange(ATabSheet: TfpgTabSheet); +procedure TfpgPageControl.DoPageChange(ATabSheet: TfpgTabSheet); begin + if (csLoading in ComponentState) then + Exit; + if (csDesigning in ComponentState) then + Exit; if Assigned(FOnChange) then FOnChange(self, ATabSheet); end; @@ -903,7 +908,6 @@ begin if h <> ActivePage then begin ActivePage := h; - DoChange(ActivePage); end; exit; end; { if } @@ -932,7 +936,6 @@ begin if ActivePage <> TfpgTabSheet(FPages.First) then begin ActivePage := TfpgTabSheet(FPages[i-1]); - DoChange(ActivePage); end; end; @@ -941,7 +944,6 @@ begin if ActivePage <> TfpgTabSheet(FPages.Last) then begin ActivePage := TfpgTabSheet(FPages[i+1]); - DoChange(ActivePage); end; end; |