Solved

Custom PageControl Sorting

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

13 Experts available now in Live!

Get 1:1 Help Now