?
Solved

Custom PageControl Sorting

Posted on 2003-12-11
3
Medium Priority
?
324 Views
Last Modified: 2010-04-05
I'd like to know a way to sort Tabs on a PageControl in the same order as in this array:

TabCaptions : array[1..7] of string =
             ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

The captions of the Tabs are the same as in the array. The PageControl is a DockSite so the Tabs are able to be removed. I would like to be able to sort these tabs upon Docking or Undocking so that it will always retain the same order.
0
Comment
Question by:Nailhead
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 1200 total points
ID: 9921829
Hi,

Try this:

procedure TForm1.Button1Click(Sender: TObject);
var i,j, k: integer;
begin
  k := 0;
  for i := 1 to 7 do begin
    for j := 0 to PageControl1.PageCount - 1 do begin
      if PageControl1.Pages[j].Caption = TabCaptions[i] then begin
        PageControl1.Pages[j].PageIndex := k;
        k := k + 1;
      end;
    end;
  end;
end;

Regards, Geo
0
 

Author Comment

by:Nailhead
ID: 9922546
Superb, thanks!!
0
 
LVL 17

Expert Comment

by:geobul
ID: 9923071
You are welcome :>)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question