• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

An editor for my VCL

I wish to add to my VCL a property name it ... ITEMS

When click on it on Object Inspector to open a form where to can add ... CATEGORIES  and ITEMS for each CATEGORY.

Category 1
         Item1
         Item2
Category 2
         Item1
.................

Clicking an ITEM to can set some properties for item and events. OnClick for example.

Can support me someone with codes ?



0
ginsonic
Asked:
ginsonic
  • 12
  • 2
  • 2
  • +3
2 Solutions
 
esoftbgCommented:
Do you want to create your own Object Inspector ?
0
 
esoftbgCommented:
I think yet I do not understand your question ....

> I wish to add to my VCL a property name it ... ITEMS
VCL - Visual Components Library ....
What could be to add a property ITEMS to VCL ? Do you want to add property ITEMS to all the Components of the VCL ?

> When click on it on Object Inspector to open a form where to can add ... CATEGORIES  and ITEMS for each CATEGORY.
TForm is not exactly a VCL-Component, it is a Container for VCL-Components ....
Do you want to create a new VCL Component named CATEGORY which contains items:  Item1 and Item2 ?

>Clicking an ITEM to can set some properties for item and events. OnClick for example.
What (a property for CATEGORY) could to be ITEM to has properties and events: it must to be a Component from VCL ....
May be you mean some kind a complex Component built from VCL-Components ? Or for example Item1 is a string property,  Item2 is a Boolean property ????

Or may be you ask how to create a new VCL-Component inherited from an existing Component ????

Can you clarify ....
0
 
moorhouselondonCommented:
The Treeview control may be worth looking at, but if your application needs to be database aware then there may be difficulties synchronising the tree with the table.
0
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!

 
Lee_NoverCommented:
easiest would be to create your Categories property as a TCollection .. then every Category could also have a property Items: TCollection
or create a form with a TTreeView and register your property editor
0
 
ginsonicAuthor Commented:
I wish to create a component alike a menu bar. But not a menu bar :)

I need something alike MenuItem but with a different editor:

 --------------------------------------------
 Category Edit box                 Items Edit box
      Add button                          Add button
   -------------------                -------------------
        listbox                               listbox
      =Cat1=                          =Item1 for Cat1=
        Cat2                               Item2 for Cat1
                                             Item3 for Cat1

   -------------------                -------------------
             MoveUp                                  MoveUp
             MoveDown                              MoveDown
             Delete button                          Delete button
-----------------------------------------------
0
 
ginsonicAuthor Commented:
Please code!
0
 
Lee_NoverCommented:
can you create the form how you like it .. I can then make it a property editor :)
0
 
ginsonicAuthor Commented:
I describe it up:

First row :

 editbox1+button1( for add) .... editbox2+button2

row two :

 listbox1 ( ctegory list) .... listbox2 ( items list for selected category )

row three
  button3,4,5 for delete selected category, move up and down .... button6,7,8 for delete selected item, move up and down
0
 
Ivanov_GCommented:
if your items are TGinsonicItem and the editor form is called TGinsonicEditor, you have to use this procedure:
RegisterComponentEditor(TGinsonicItem, TGinsonicEditor)

some example:
http://delphi.vitpc.com/asp/viewitem.asp?catalogid=741
0
 
ginsonicAuthor Commented:
I know that :), my problem is the work untill registration.

How to create a category property that can contain items and how to assign events for categories or items.

For example, when I will click a category title to do something and when click an item of the same category to do something else.
0
 
ginsonicAuthor Commented:
Lee_Nover this is the form editor:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Edit1: TEdit;
    Button1: TButton;
    GroupBox2: TGroupBox;
    Edit2: TEdit;
    Button2: TButton;
    ListBox1: TListBox;
    ListBox2: TListBox;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.
0
 
ginsonicAuthor Commented:
The dfm:

object Form1: TForm1
  Left = 234
  Top = 191
  Width = 628
  Height = 455
  Caption = 'Category editor'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object GroupBox1: TGroupBox
    Left = 8
    Top = 8
    Width = 297
    Height = 321
    Caption = ' Category '
    TabOrder = 0
    object Edit1: TEdit
      Left = 16
      Top = 16
      Width = 209
      Height = 21
      TabOrder = 0
    end
    object Button1: TButton
      Left = 232
      Top = 16
      Width = 49
      Height = 21
      Caption = 'Add'
      TabOrder = 1
    end
    object ListBox1: TListBox
      Left = 16
      Top = 48
      Width = 265
      Height = 257
      ItemHeight = 13
      TabOrder = 2
    end
  end
  object GroupBox2: TGroupBox
    Left = 312
    Top = 8
    Width = 297
    Height = 321
    Caption = ' Items '
    TabOrder = 1
    object Edit2: TEdit
      Left = 16
      Top = 16
      Width = 209
      Height = 21
      TabOrder = 0
    end
    object Button2: TButton
      Left = 232
      Top = 16
      Width = 49
      Height = 21
      Caption = 'Add'
      TabOrder = 1
    end
    object ListBox2: TListBox
      Left = 16
      Top = 48
      Width = 265
      Height = 257
      ItemHeight = 13
      TabOrder = 2
    end
  end
  object Button3: TButton
    Left = 8
    Top = 336
    Width = 49
    Height = 21
    Caption = 'Delete'
    TabOrder = 2
  end
  object Button4: TButton
    Left = 240
    Top = 336
    Width = 33
    Height = 21
    Caption = 'Up'
    TabOrder = 3
  end
  object Button5: TButton
    Left = 272
    Top = 336
    Width = 33
    Height = 21
    Caption = 'Down'
    TabOrder = 4
  end
  object Button6: TButton
    Left = 312
    Top = 336
    Width = 49
    Height = 21
    Caption = 'Delete'
    TabOrder = 5
  end
  object Button7: TButton
    Left = 544
    Top = 336
    Width = 33
    Height = 21
    Caption = 'Up'
    TabOrder = 6
  end
  object Button8: TButton
    Left = 576
    Top = 336
    Width = 33
    Height = 21
    Caption = 'Down'
    TabOrder = 7
  end
  object TGroupBox
    Left = 424
    Top = 360
    Width = 185
    Height = 54
    TabOrder = 8
    object BitBtn1: TBitBtn
      Left = 20
      Top = 16
      Width = 75
      Height = 25
      TabOrder = 0
      Kind = bkOK
    end
    object BitBtn2: TBitBtn
      Left = 100
      Top = 16
      Width = 75
      Height = 25
      Cancel = True
      Caption = 'Cancel'
      Default = True
      ModalResult = 2
      TabOrder = 1
      Glyph.Data = {
        DE010000424DDE01000000000000760000002800000024000000120000000100
        0400000000006801000000000000000000001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
        333333333333333333333333000033338833333333333333333F333333333333
        0000333911833333983333333388F333333F3333000033391118333911833333
        38F38F333F88F33300003339111183911118333338F338F3F8338F3300003333
        911118111118333338F3338F833338F3000033333911111111833333338F3338
        3333F8330000333333911111183333333338F333333F83330000333333311111
        8333333333338F3333383333000033333339111183333333333338F333833333
        00003333339111118333333333333833338F3333000033333911181118333333
        33338333338F333300003333911183911183333333383338F338F33300003333
        9118333911183333338F33838F338F33000033333913333391113333338FF833
        38F338F300003333333333333919333333388333338FFF830000333333333333
        3333333333333333333888330000333333333333333333333333333333333333
        0000}
      NumGlyphs = 2
    end
  end
end
0
 
Ivanov_GCommented:
if the Category property is ... TCollectionItem for example... ?

I don't understand your question. Can you explain in Full details - what property, its type, etc...
0
 
ginsonicAuthor Commented:
To say first category:

Caption:='Category One';
Color:=clRed;
Font:= ......
Style:=..
.....
OnCLick:=....
OmMouseEnter:=....
OnMouseExit:=.........

Category One have a number of items:

Caption:='Item One for Category One';
Color:=clGreen;
Font:= ......
Style:=..
.....
OnCLick:=....
OmMouseEnter:=....
OnMouseExit:=.........

Caption:='Item Two for Category One';
Color:=clYellow;
Font:= ......
Style:=..
.....
OnCLick:=....
OmMouseEnter:=....
OnMouseExit:=.........

0
 
ginsonicAuthor Commented:
To understand my needs drop a TMainMenu on you form, double click it and .... VOILA....

The only different thing is the editor look. I wish to have one as the above one ( see may top code ).
0
 
ginsonicAuthor Commented:
Nobody can help me?
0
 
Wim ten BrinkCommented:
So, if I understand correctly, you want a component that contains other components and divides them into categories? So, a category for labels, a category for editboxes, a category for Memo's... Then, under these categories you want to have a list of objects that are of this type of category... Something like: (raw, untested code)

type
  TCategoryList = class(TComponent)
    property Categories: array of TCategory;
  end;
  TCategory = class(TComponent)
    property Name: string;
    property LimitToClass: TComponentClass;
    property Items: array of TComponent;
  end;

And the items in each TCategory should be of the type that's stored in LimitToClass? Something like that? With a nice form that allows you to create new items of the specified class? And adding new categories?
0
 
ginsonicAuthor Commented:
No, I wish to make something alike an Outlook bar and wish to have for each outlook button ( category ) some items.

----------------
Category One
----------------
Item1
Item2
----------------
Category Two
----------------
Item1
Item2
Item3
----------------

0
 
Wim ten BrinkCommented:
Oh, ok. Seems to me the visualization part would be the biggest problem. The thing itseld would just be a dynamic array of categories and per category a dynamic array of items. (Or TList/TStringList/TWhateverListYouLike.)
There must be thousands of similar components on the net by now. Can't you just cheat and look how others solve this in their code? ;-)
0
 
ginsonicAuthor Commented:
I try many..many..many ... codes. I don't like what I found for Outlook components. I wish a TMainMenu but with my own editor form.

0
 
ginsonicAuthor Commented:
I figure out a way to my problem.  I will let opened for couple days this topic, maybe somebody come with a different solution.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 12
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now