Solved

Custom PageControl Sorting

Posted on 2003-12-11
3
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 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