[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;
> 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