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
Solved

PageControl Sorting

Posted on 2003-12-05
2
328 Views
Last Modified: 2010-04-05
Anyone know how to sort tabs on a PageControl according to their captions, perhaps as alphabetically? Or if that's too hard of a question, how about if the tabs's captions are numbered and I want to sort them in ascending order?
0
Comment
Question by:Nailhead
2 Comments
 
LVL 8

Accepted Solution

by:
gmayo earned 140 total points
ID: 9884235
procedure TForm1.Button1Click(Sender: TObject);
var
      i : integer;
      reloop : boolean;
begin
      reloop := true;
      while reloop = true do begin
            reloop := false;
            for i := 0 to PageControl1.PageCount - 2 do begin
                  if PageControl1.Pages[i].Caption > PageControl1.Pages[i + 1].Caption then begin
                        PageControl1.Pages[i].PageIndex := i + 1;
                        reloop := true;
                  end;
            end;
      end;
end;

Works for text and numbers.

Geoff M.
0
 

Author Comment

by:Nailhead
ID: 9884517
Wow, worked like a charm! Thanks a million!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
Dev Express grid collapse 2 45
control image tags in a string ? 12 140
How to build JSON File in Delphi 6 3 44
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

792 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