Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Composite Control

0 views
Skip to first unread message

Jimmy

unread,
Jan 12, 2006, 2:44:59 AM1/12/06
to
I have a composite control with a label and a dropdownbox. I have created a
Datasource : TObject property in the composite control and are trying to
pass this on to the internal Dropdownbox. The propblem is that in the object
inspector my new datasource proprerty is grayed out. Here is some of the
code I have so far where CustomControl is the local dropdownlist:


[Bindable(true), Category('Data')]
//PersistenceMode(PersistenceMode.Attribute)
property DataSource : TObject read getDataSource write setDataSource;


function LabeledDropDown.getDataSource: TObject;
begin
EnsureChildControls;
Result := DropDownList(CustomControl).DataSource;
end;


procedure LabeledDropDown.setDataSource(Value: TObject);
begin
EnsureChildControls;
DropDownList(CustomControl).DataSource := Value;
end;

Nick Hodges [TeamB]

unread,
Jan 12, 2006, 7:46:43 AM1/12/06
to
Jimmy wrote:

> I have a composite control with a label and a dropdownbox. I have
> created a Datasource : TObject property in the composite control and
> are trying to pass this on to the internal Dropdownbox.

Use the datasource of the internal control as the datasource for the
"outer" control. In other words, do the getter/setter like this:

function LabeledDropDown.getDataSource: TObject;
begin
EnsureChildControls;

Result := MyInternalDropdown.DataSource;
end;


procedure LabeledDropDown.setDataSource(Value: TObject);
begin
EnsureChildControls;

MyInternalDropDown.DataSource := Value;
end;

--
Nick Hodges -- TeamB
Dunn Solutions Group -- http://www.dunnsolutions.com
Read my Blog -- http://www.lemanix.com/nickblog

0 new messages