?
Solved

Screen Like NetScape Navigator Preference

Posted on 1998-12-28
4
Medium Priority
?
182 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
[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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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