Solved

Screen Like NetScape Navigator Preference

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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