I have a component that has a custom property editor for one of its properties. The editor provides a drop-down list of items that the user can select, this works as expected. I would like to modify the editor so that the list of items in the drop-down list depends also on the value of another property in the same component. How do I design a custom property editor that can access a property of a component other than the property for which the editor is registered? Regards FarmerJo
![]() |
0 |
![]() |
John wrote: > How do I design a custom property editor that can access a property > of a component other than the property for which the editor is > registered? Use the GetComponent() method to retreive a pointer to the component that is being edited, then type-cast it to your component's class type in order to access other members of it. For example: {code} void __fastcall TMyPropEditor::GetValues(TGetStrProc Proc) { TMyComponent *Comp = (TMyComponent*) GetComponent(0); // use Comp as needed, calling Proc() for each desired value ... } {code} -- Remy Lebeau (TeamB)
![]() |
0 |
![]() |
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote} > John wrote: > > > How do I design a custom property editor that can access a property > > of a component other than the property for which the editor is > > registered? > > Use the GetComponent() method to retreive a pointer to the component that > is being edited, then type-cast it to your component's class type in order > to access other members of it. > > For example: > > {code} > void __fastcall TMyPropEditor::GetValues(TGetStrProc Proc) > { > TMyComponent *Comp = (TMyComponent*) GetComponent(0); > // use Comp as needed, calling Proc() for each desired value ... > } > {code} > > -- > Remy Lebeau (TeamB) Hi Remy, Many thanks for the quick answer, once again it has been a great help. Cheers, FamerJohn
![]() |
0 |
![]() |