Solved

Custom PageControl Sorting

Posted on 2003-12-11
3
288 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 300 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now