Solved

PageControl Sorting

Posted on 2003-12-05
2
316 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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