?
Solved

Custom PageControl Sorting

Posted on 2003-12-11
3
Medium Priority
?
313 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 1200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 18 hours left to enroll

762 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