?
Solved

Screen Like NetScape Navigator Preference

Posted on 1998-12-28
4
Medium Priority
?
183 Views
Last Modified: 2010-04-04
i would like to write a interface like NetScape Navigator Preferences screen, there is a tree view on the left and content all the items need to be setup. on the right is the information entering screen, so every item in tree view will have different infomation screen on the right. i know it's a one parent form with tree view and import in the rest of the child forms with different information. how to do that ? or any others good suggestion..? please give an example code here
0
Comment
Question by:dumper
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 400 total points
ID: 1353475
Actually you only need one form - you are most of the way there.

Here's how it works: Place a tree view and make it align left. Place a TPageControl on the form and make it align client. Then create pages in the Pagr Control, one for each page of preferences you want to make. Set the TabVisible property to false for each page.

Add the items into the tree view. Set the Data property of each item to the page it should bring up like this:

  TheNode.Data := Pointer(APageInPageControl);

In the OnChange event for the treeview you make the relevent preferences page show be doing this:

  ThePageControl.ActivePage := TTabSheet(Node.Data);

I haven't whipped up sample code because it is really as simple as I have described - if you do still want sample code I can put that together...

Cheers,

Raymond.
0
 

Author Comment

by:dumper
ID: 1353476
ok...please give me an example code here...and actually what does following code do?

ThePageControl.ActivePage := TTabSheet(Node.Data);
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1353477
I'll post the sample code a bit later today...

ThePageControl.ActivePage := TTabSheet(Node.Data); does the following:

Take the value of Node.Data (to which we assume we have assigned a pointer to an instance of a TTanSheet), cast it to a TTabSheet and then assign it to the ActivePage property of the TPageControl which will cause that page to be displayed as the active or visible page in the page control...

Cheers,

Raymond.


0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1353478
Here is the form and DFM file to use as a sample. I have left the tabs visible so you see what happens.

Cheers,

Raymond.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls;

type
  TForm1 = class(TForm)
    TreeView1: TTreeView;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    procedure FormCreate(Sender: TObject);
    procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Treeview1.Items[0].data := pointer(tabsheet1);
  Treeview1.Items[1].data := pointer(tabsheet2);
end;

procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
begin
  PageControl1.ActivePage := TTabSheet(Node.Data);
end;

end.




object Form1: TForm1
  Left = 330
  Top = 130
  Width = 696
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object TreeView1: TTreeView
    Left = 0
    Top = 0
    Width = 121
    Height = 453
    Align = alLeft
    Indent = 19
    Items.Data = {
      02000000220000000000000000000000FFFFFFFFFFFFFFFF0000000000000000
      09546162736865657431220000000000000000000000FFFFFFFFFFFFFFFF0000
      00000000000009546162536865657432}
    TabOrder = 0
    OnChange = TreeView1Change
  end
  object PageControl1: TPageControl
    Left = 121
    Top = 0
    Width = 567
    Height = 453
    ActivePage = TabSheet2
    Align = alClient
    TabOrder = 1
    object TabSheet1: TTabSheet
      Caption = 'TabSheet1'
    end
    object TabSheet2: TTabSheet
      Caption = 'TabSheet2'
      ImageIndex = 1
    end
  end
end
 



0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month16 days, 16 hours left to enroll

864 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