New custom Component

Please discuss general Delphi programming topics here.

New custom Component

Postby gallo » March 16th, 2009, 11:18 am

I am Creating a new component derived from TCustomGropuBox. I had implemented some new properties in this component such as "TYpe" and "Status".
this two properties are of Unumerated type tha means they have a Enumerated type as reference:

TType=(Station,Pallet);
TStatus=(OnWorking,Done,Raw,Locked)

Now I would like to influence the contents of propertry "Status" dependig to what user select in "Type". To be more clear, if the user select "Pallet" in "Type" in the Property "Satus" the option should be as report above, if instead the user select the option "Station" in "Type" the following option should be avaiable in "Status":

TStatus=(Enabled, disabled);

Do you Known how I can mamde it in Delhi?

Thanks
gallo
Member
Member
 
Posts: 2
Joined: March 16th, 2009, 8:58 am

Re: New custom Component

Postby Kambiz » March 16th, 2009, 2:42 pm

According to the fact that data types are static, you cannot do what you want.

Instead, use two status data types, one for station and the other for pallet.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: New custom Component

Postby gallo » March 18th, 2009, 7:32 am

Thanks for your quickly answer.

Ok I will use two properties, but can I disable/hide one of two properties in depending of what the user choose in "Type" (pallet or station).

I have one more question.
It is possible use the Properties "Trasparent" which is tipically of a "TLabel" component in my "GroupBox" component, I have try in diferent way without result.
Of course if you have an other idea it will be good aniway( I need to draw a drawing in my component but with the background color trasparent).

Thanks in advance.
gallo
Member
Member
 
Posts: 2
Joined: March 16th, 2009, 8:58 am

Re: New custom Component

Postby Kambiz » March 18th, 2009, 9:33 am

No, you cannot hide/show a property in object inspector.

Just defining the Transparent property doesn't make a control transparent. You have to override wither WM_ERASEBKGND message or Paint method to draw parent's background on the control's canvas. For this purpose you can use theme manager methods. Searching the net may show you some other options for drawing parent's background.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron