Board index » cppbuilder » Customize a component

Customize a component


2006-08-21 08:54:12 PM
cppbuilder106
Hi,
I derived my class SplashScreen from TForm.
I would like to add some properties like below (object inspector ->
Properties) :
Layout
+Image
- Source :
- Filename :
- Resource ID :
where if i expand Image, i can see the 3 properties (source, filename
and resource ID).
'filename' and 'resource id' properties depends on the value of 'source'.
Moreover, i do not want to see all my additional Properties under
'Miscellaneous'... but i would like to place some under 'Layout' part.
but i do not know how can i do that.
thanks a lot,
Al.
 
 

Re:Customize a component

"--== Alain ==--" < XXXX@XXXXX.COM >wrote in message
Quote
I would like to add some properties like below (object inspector ->
Properties) :
Basically you need to register your splash form as a custom form. Check out
this link. It might be what you need (what out for wordwrap).
groups.google.com/group/
borland.public.delphi.vcl.components.writing/msg/39995248c070a47d
-or-
tinyurl.com/j3wzb
Quote
Moreover, i do not want to see all my additional Properties under
'Miscellaneous'... but i would like to place some under 'Layout' part.
Check out RegisterPropertiesInCategory() in the help.
- Clayton
 

Re:Customize a component

Hi Clayton
Im trying to do something in the same line.
also found your post:
groups.google.com/group/borland.public.cppbuilder.vcl.components.writing/msg/9e0926ffa5289bd9
This was a while ago and I tried thisto no avail.. I keep on getting
the following message when I try to compile the package:
---------------------------
Error
---------------------------
Error in module TestFormUnit: Incorrect field declaration in class
TTestForm.
---------------------------
OK Help Details>>
---------------------------
Im pasting the listing so sorry for the length:
TestFormPack.cpp: Package file
===========================================
//---------------------------------------------------------------------------
#include <basepch.h>
#pragma hdrstop
USEFORM("TestFormUnit.cpp", TestForm);
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Package source.
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}
//---------------------------------------------------------------------------
===========================================
TestFormUnit.cpp:
===========================================
//---------------------------------------------------------------------------
#ifndef TestFormUnitH
#define TestFormUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DesignEditors.hpp>
#include <DesignIntf.hpp>
//---------------------------------------------------------------------------
class PACKAGE TTestForm : public TForm
{
__published: // IDE-managed Components
__property int TestInt = {read = FTestInt, write = FTestInt};
private: // User declarations
int FTestInt;
public: // User declarations
__fastcall TTestForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TTestForm *TestForm;
//---------------------------------------------------------------------------
#endif
===========================================
TestformUnit.h:
===========================================
//---------------------------------------------------------------------------
#ifndef TestFormUnitH
#define TestFormUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DesignEditors.hpp>
#include <DesignIntf.hpp>
//---------------------------------------------------------------------------
class PACKAGE TTestForm : public TForm
{
__published: // IDE-managed Components
__property int TestInt = {read = FTestInt, write = FTestInt};
private: // User declarations
int FTestInt;
public: // User declarations
__fastcall TTestForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TTestForm *TestForm;
//---------------------------------------------------------------------------
#endif
===========================================
 

{smallsort}

Re:Customize a component

Hi Clayton
Im trying to do something in the same line.
also found your post:
groups.google.com/group/borland.public.cppbuilder.vcl.componen...
This was a while ago and I tried this to no avail.. I keep on getting
the following message when I try to compile the package:
===========================================
Error in module TestFormUnit: Incorrect field declaration in class
TTestForm.
===========================================
I set my package to designtime only.
Im pasting the listing so sorry for the length:
TestFormPack.cpp: Package file
===========================================
//---------------------------------------------------------------------------
#include <basepch.h>
#pragma hdrstop
USEFORM("TestFormUnit.cpp", TestForm);
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Package source.
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}
//---------------------------------------------------------------------------
===========================================
TestformUnit.h:
===========================================
//---------------------------------------------------------------------------
#ifndef TestFormUnitH
#define TestFormUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DesignEditors.hpp>
#include <DesignIntf.hpp>
//---------------------------------------------------------------------------
class PACKAGE TTestForm : public TForm
{
__published: // IDE-managed Components
__property int TestInt = {read = FTestInt, write = FTestInt};
private: // User declarations
int FTestInt;
public: // User declarations
__fastcall TTestForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TTestForm *TestForm;
//---------------------------------------------------------------------------
#endif
===========================================
TestFormUnit.cpp:
===========================================
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TestFormUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TTestForm *TestForm;
//---------------------------------------------------------------------------
__fastcall TTestForm::TTestForm(TComponent* Owner)
: TForm(Owner)
{
}
namespace TestFormUnit
{
void __fastcall PACKAGE Register()
{
RegisterCustomModule(__classid(TTestForm),
__classid(TCustomModule));
}
}
//---------------------------------------------------------------------------
===========================================