 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lars Guest
|
Posted: Mon Jul 19, 2004 2:34 pm Post subject: Show the collection property Editor for a sub-component prop |
|
|
Hi all,
I've problems to show in object inspector, the editor for properties
(collection derived) for a sub component property. The oi displays a
element for this property, but a elipse click does not start the
collection editor .
Here some sample code:
//.hpp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class PACKAGE TComponent1 : public TComponent
{
typedef Classes::TComponent inherited;
private:
bool FTestbool;
TGroupEnableItems* FActionItems;
TGroups* FGroup1;
protected:
public:
__fastcall TComponent1(TComponent* Owner);
__published:
__property bool Testbool = { read=FTestbool, write=FTestbool };
__property TGroupEnableItems* ActionItems = {
read=FActionItems, write=FActionItems };
__property TGroups* Group1 = { read=FGrpup1, write=FGrpup1 };
};
//---------------------------------------------------------------------------
class TGroups : public TPersistent
{
private:
TGroupEnableItems* FActionItems;
bool FTestBool1;
AnsiString FString1;
TPersistent* FOwner;
public:
__fastcall TGroups();
__fastcall TGroups(TPersistent* AOwner);
__published:
__property TGroupEnableItems* ActionItems = {
read=FActionItems, write=FActionItems };
__property bool TestBool1 = { read=FTestBool1, write=FTestBool1 };
__property AnsiString String1 = { read=FString1, write=FString1 };
};
//---------------------------------------------------------------------------
class PACKAGE TGroupEnableItem: public TCollectionItem
{
public:
private:
...
protected:
...
__published:
...
};
//---------------------------------------------------------------------------
class PACKAGE TGroupEnableItems: public TCollection
{
typedef Classes::TPersistent inherited;
private:
TPersistent* FOwner;
protected:
DYNAMIC TPersistent* __fastcall GetOwner(void);
public:
__fastcall TGroupEnableItems(TPersistent* AOwner);
};
//.cpp+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
....
__fastcall TComponent1::TComponent1(TComponent* Owner)
: TComponent(Owner)
{
FActionItems= new TGroupEnableItems(this);
FGroup1 = new TGroups(this);
}
//---------------------------------------------------------------------------
__fastcall TGroups::TGroups()
{
FActionItems = new TGroupEnableItems(NULL);
}
__fastcall TGroups::TGroups(TPersistent* AOwner)
{
FActionItems = new TGroupEnableItems(AOwner);
}
I've here ActionItems twice:
- Once as property of Component1. A click on this element starts the
collection editor.
- Second as property of Groups. A click on this element does not starts
the collecction editor! Why?
Thanks for any ideas.
|
|
| Back to top |
|
 |
Todd Brylski Guest
|
Posted: Tue Jul 20, 2004 1:15 am Post subject: Re: Show the collection property Editor for a sub-component |
|
|
"Lars" <no.spam (AT) for (DOT) me> wrote
| Quote: | I've problems to show in object inspector, the editor for properties
(collection derived) for a sub component property. The oi displays a
element for this property, but a elipse click does not start the
collection editor .
|
A TGroups::GetOwner() method must be implemented.
I took the liberty of rewriting your code:
class PACKAGE TGroupEnableItem: public TCollectionItem
{
typedef TCollectionItem inherited;
int FValue1;
public:
__fastcall TGroupEnableItem( TCollection* ACollection );
__published:
__property int Value1 = { read=FValue1, write=FValue1 };
};
//---------------------------------------------------------------------------
class PACKAGE TGroupEnableItems: public TOwnedCollection
{
typedef TOwnedCollection inherited;
public:
__fastcall TGroupEnableItems(TPersistent* AOwner);
TGroupEnableItem* __fastcall Add();
};
//---------------------------------------------------------------------------
class PACKAGE TGroups : public TPersistent
{
typedef TPersistent inherited;
TGroupEnableItems* FActionItems;
bool FTestBool1;
AnsiString FString1;
TPersistent* FOwner;
public:
__fastcall TGroups(TPersistent* AOwner);
__fastcall ~TGroups();
DYNAMIC TPersistent* __fastcall GetOwner();
__published:
__property TGroupEnableItems* ActionItems = { read=FActionItems, write=FActionItems };
__property bool TestBool1 = { read=FTestBool1, write=FTestBool1 };
__property AnsiString String1 = { read=FString1, write=FString1 };
};
//---------------------------------------------------------------------------
class PACKAGE TComponent1 : public TComponent
{
typedef TComponent inherited;
bool FTestbool;
TGroupEnableItems* FActionItems;
TGroups* FGroup1;
public:
__fastcall TComponent1(TComponent* Owner);
__fastcall ~TComponent1();
__published:
__property bool Testbool = { read=FTestbool, write=FTestbool };
__property TGroupEnableItems* ActionItems = { read=FActionItems, write=FActionItems };
__property TGroups* Group1 = { read=FGroup1, write=FGroup1 };
};
//---------------------------------------------------------------------------
__fastcall TGroupEnableItem::TGroupEnableItem( TCollection* ACollection )
: TCollectionItem(ACollection)
{
}
//----------------------------------------------------------------------------
__fastcall TGroupEnableItems::TGroupEnableItems( TPersistent* AOwner )
: TOwnedCollection( AOwner, __classid(TGroupEnableItem) )
{
}
TGroupEnableItem* __fastcall TGroupEnableItems::Add()
{
return (TGroupEnableItem*) inherited::Add();
}
//----------------------------------------------------------------------------
__fastcall TGroups::TGroups(TPersistent* AOwner)
: TPersistent(), FOwner(AOwner)
{
FActionItems = new TGroupEnableItems(AOwner);
}
__fastcall TGroups::~TGroups()
{
delete FActionItems;
}
TPersistent* __fastcall TGroups::GetOwner()
{
return FOwner;
}
//----------------------------------------------------------------------------
__fastcall TComponent1::TComponent1(TComponent* Owner)
: TComponent(Owner)
{
FActionItems = new TGroupEnableItems(this);
FGroup1 = new TGroups(this);
}
__fastcall TComponent1::~TComponent1()
{
delete FGroup1;
delete FActionItems;
}
Todd
|
|
| Back to top |
|
 |
Lars Guest
|
Posted: Tue Jul 20, 2004 7:00 am Post subject: Re: Show the collection property Editor for a sub-component |
|
|
Todd Brylski schrieb:
| Quote: | "Lars" <no.spam (AT) for (DOT) me> wrote
I've problems to show in object inspector, the editor for properties
(collection derived) for a sub component property. The oi displays a
element for this property, but a elipse click does not start the
collection editor .
A TGroups::GetOwner() method must be implemented.
I took the liberty of rewriting your code:
class PACKAGE TGroupEnableItem: public TCollectionItem
{
typedef TCollectionItem inherited;
int FValue1;
public:
__fastcall TGroupEnableItem( TCollection* ACollection );
__published:
__property int Value1 = { read=FValue1, write=FValue1 };
};
//---------------------------------------------------------------------------
class PACKAGE TGroupEnableItems: public TOwnedCollection
{
typedef TOwnedCollection inherited;
public:
__fastcall TGroupEnableItems(TPersistent* AOwner);
TGroupEnableItem* __fastcall Add();
};
//---------------------------------------------------------------------------
class PACKAGE TGroups : public TPersistent
{
typedef TPersistent inherited;
TGroupEnableItems* FActionItems;
bool FTestBool1;
AnsiString FString1;
TPersistent* FOwner;
public:
__fastcall TGroups(TPersistent* AOwner);
__fastcall ~TGroups();
DYNAMIC TPersistent* __fastcall GetOwner();
__published:
__property TGroupEnableItems* ActionItems = { read=FActionItems, write=FActionItems };
__property bool TestBool1 = { read=FTestBool1, write=FTestBool1 };
__property AnsiString String1 = { read=FString1, write=FString1 };
};
//---------------------------------------------------------------------------
class PACKAGE TComponent1 : public TComponent
{
typedef TComponent inherited;
bool FTestbool;
TGroupEnableItems* FActionItems;
TGroups* FGroup1;
public:
__fastcall TComponent1(TComponent* Owner);
__fastcall ~TComponent1();
__published:
__property bool Testbool = { read=FTestbool, write=FTestbool };
__property TGroupEnableItems* ActionItems = { read=FActionItems, write=FActionItems };
__property TGroups* Group1 = { read=FGroup1, write=FGroup1 };
};
//---------------------------------------------------------------------------
__fastcall TGroupEnableItem::TGroupEnableItem( TCollection* ACollection )
: TCollectionItem(ACollection)
{
}
//----------------------------------------------------------------------------
__fastcall TGroupEnableItems::TGroupEnableItems( TPersistent* AOwner )
: TOwnedCollection( AOwner, __classid(TGroupEnableItem) )
{
}
TGroupEnableItem* __fastcall TGroupEnableItems::Add()
{
return (TGroupEnableItem*) inherited::Add();
}
//----------------------------------------------------------------------------
__fastcall TGroups::TGroups(TPersistent* AOwner)
: TPersistent(), FOwner(AOwner)
{
FActionItems = new TGroupEnableItems(AOwner);
}
__fastcall TGroups::~TGroups()
{
delete FActionItems;
}
TPersistent* __fastcall TGroups::GetOwner()
{
return FOwner;
}
//----------------------------------------------------------------------------
__fastcall TComponent1::TComponent1(TComponent* Owner)
: TComponent(Owner)
{
FActionItems = new TGroupEnableItems(this);
FGroup1 = new TGroups(this);
}
__fastcall TComponent1::~TComponent1()
{
delete FGroup1;
delete FActionItems;
}
Todd
Hi Todd, |
Many, many thanks. You have point me on the right direction.
Lars
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Jul 20, 2004 6:58 pm Post subject: Re: Show the collection property Editor for a sub-component |
|
|
"Lars" <no.spam (AT) for (DOT) me> wrote
| Quote: | Many, many thanks. You have point me on the right direction.
|
For future reference, please trim your replies.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|