Solved

An editor for my VCL

Posted on 2004-10-03
21
305 Views
Last Modified: 2010-04-05
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
Comment
Question by:ginsonic
  • 12
  • 2
  • 2
  • +3
21 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12212504
Do you want to create your own Object Inspector ?
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12212547
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
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 12212612
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
 
LVL 12

Accepted Solution

by:
Lee_Nover earned 250 total points
ID: 12212637
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12212665
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12212669
Please code!
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 12212690
can you create the form how you like it .. I can then make it a property editor :)
0
 
LVL 9

Author Comment

by:ginsonic
ID: 12214567
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
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12214965
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12217146
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
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.

 
LVL 9

Author Comment

by:ginsonic
ID: 12217374
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12217380
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
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 250 total points
ID: 12217566
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12217677
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12217691
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12226403
Nobody can help me?
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12227381
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12227606
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
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12228082
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12228397
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
 
LVL 9

Author Comment

by:ginsonic
ID: 12237621
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

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

15 Experts available now in Live!

Get 1:1 Help Now