Solved

Screen Like NetScape Navigator Preference

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
A short film showing how OnPage and Connectwise integration works.

948 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

16 Experts available now in Live!

Get 1:1 Help Now