Solved

Screen Like NetScape Navigator Preference

Posted on 1998-12-28
4
175 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 100 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

20 Experts available now in Live!

Get 1:1 Help Now