TPageControl lazarus / 8-Other ---------------------------------------------------------------------- nigelg99 · 2009-04-07 22:59 I am porting a small programme from Delphi on Windows to the Mac.  It is like an Apple Assistant or Windows Wizard, i.e. it is a page control with buttons to go to the next page, etc. I have created a TPageControl and put on buttons to go forward & back through the pages.  Clicking on the Next button shows the next page, clicking on the Back button shows the previous page.  The pages are set in the button events using the ActivePageIndex property. This works fine if the tabs are visible, but if I hide the tabs (I don't want the user randomly going from page to page, of course), the back button doesn't work!  I get an assortment of controls shown from each page. Has anybody come across this before?  Is there a workaround or fix for this? I have attached a  form (pas & lfm files) that I've created to test this out.  It works fine if TabVisible is True for the TabSheets, but gets funny effects if this property is False. ---------------------------------------------------------------------- nigelg99 · 2009-04-09 14:45 I have figured out a workaround for myself  .  The visibility of the tabs doesn't seem to be managed property by the TPageControl, so I simply do it myself using the following procedure: Procedure TForm1.SetPage (Const APage : Integer);   Var     j : Integer;   Begin  { SetPage }     PageControl1.ActivePageIndex := APage;     For j := 0 To Pred (PageControl1.PageCount) Do       If (j <> APage) Then         PageControl1.Page[j].Visible := False;     PageControl1.Page[APage].Visible := True;   End;  { SetPage } Now, whenever I want to change a page, I call SetPage and it takes care of all the visible properties itself. ---------------------------------------------------------------------- .yankee · 2011-05-25 13:09 I have the same problem - but your solution does not work for me!  The TPageControl component seems seriously ...messed... up. And how long has this been such! ---------------------------------------------------------------------- fabienwang · 2011-05-25 13:38 Why not use the TNotebook or TExtendedNotebook? ---------------------------------------------------------------------- Blaazen · 2011-05-25 14:00 Here was another thread about TPageControl: http://www.lazarus.freepascal.org/index.php/topic,12985.0.html Or make bugreport if TPageControl does not work. IIRC TNotebook is deprecated in 0.9.30. ---------------------------------------------------------------------- felipemdc · 2011-05-25 14:05 Quote from: Blaazen on May 25, 2011, 04:00:12 pmIIRC TNotebook is deprecated in 0.9.30. It isn't. The old and wrong TNotebook was deprecated and now removed. But, if you use Lazarus 0.9.31+ you can use the new TNotebook which seams to be what the original asker should use. ---------------------------------------------------------------------- .yankee · 2011-05-25 15:39 Quote from: FabienWang on May 25, 2011, 03:38:55 pmWhy not use the TNotebook or TExtendedNotebook? Because I already have the whole interface built on TPageControl - it looked like the obvious thing to use and used to work until I tried to make some pages optionally visible. Now I needed to use a cruel work-around. I make the program switch between "standard" and "advanced" views. When in "standard" view, I set the ShowTabs property to false to make some pages inaccessible directly. Then, to select next page, I use : Code: [Select]     curInd:= TataStron.ActivePageIndex;      pmax:= TataStron.PageCount-2;      if (curInd >= strMin) and (curInd <= pmax) then         TataStron.ActivePageIndex:= curInd+1; ("TataStron" is the TPageControl object) and I modify the "strMin" variable when changing between "standard" and "advanced" views. This of course makes sense only if ShowTabs is false in the "standard" view - which, fortunately, I can bear for now. ---------------------------------------------------------------------- davesimplewear · 2011-05-25 22:09 i use the Rx pageManager for what you are doing, just nominate the pageControl and the buttons hide the tabs and you have a wizard, the buttons disable when you reach the end and before you start. Regards Dave