Custom property editor that can access other properties of a component.

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
2/28/2014 9:32:55 PM
embarcadero.cppbuilder.writing 359 articles. 0 followers. Follow

2 Replies
949 Views

Similar Articles

[PageSpeed] 34
Get it on Google Play
Get it on Apple App Store

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
Remy
3/1/2014 12:13:28 AM
> {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
John
3/2/2014 6:40:05 PM
Reply:

Similar Artilces:

Custom property editor accessing other component properties
I have a component which has a custom property editor for one of its properties. The custom property editor is derived from TStringProperty and works as expected. I need to, however, modify the editor to show a number of user selectable items which depends on the value of another property in the same component. How do you design a property editor for a component that can reference other properties of the component besides the one that it is designed to edit? I am using BCB6. Regards FarmerJo John wrote: > I have a component which has a custom property editor for one of its &...

Writing a TIntegerList property with his property editor and enumerator
Hi ! I wrote a blog article about writing a class to implement a list of integers suitable as a component property (TList<Integer> isn't suitable for such use) having his own property editor. This TIntegerList merely looks like TStringList but has integers instead of strings. Using the object inspector, you can edit the list of integers. Link: http://francois-piette.blogspot.com/2012/12/tintegerlist-property-and-property.html I wrote a second article explaining how to add an enumerator or iterator to TIntegerList class. Having an enumerator allows you to use th...

Property Accessing other properties
 hello i am new to asp.net and also c# and trying to learn some basic concepts now. I am reading article about the font propertyI am a little confused here. My question is Font property belong to WebControl class Font properties belong to FontUnit Class. How does the Font property access the font properties in the FontUnit ClassPlease if somebody could clarify this point for methanx Hi, As far as I can see, FontUnit represents the size of a font. So please look the following code.         Button bt = new Button(); // we create  a ...

How can I access custom properties from JavaScript
Hi everybody, I have a class called AutoSuggestBox <Custom:AutoSuggestBox ID="asbSpouse" ToolTip="Start typing name and select from the list" runat="server" AutoCompleteType="Disabled" DataType='<%# Eval("Gender") =="M"?"Mother":"Father" %>' IncludeMoreMenuItem="True" KeyPressDelay="300" MaxSuggestChars="5" MenuCSSClass="asbMenu" MenuItemCSSClass="asbMenuItem" MoreMenuItemLabel="..." NumMenuItems="10" OnPreRender="A...

Using VS CssClass Property Editor for custom control CssClass property
I am developing a custom composite control, which includes a Title and a Description label (among other things) I want to allow the user to define the CSS Class names for the control's components using specific properties, such as TitleCssClass, DescriptionCssClass.  At design time, I would like to provide the same editing experience offered by VS for the control CssClass, i.e. a dropdown list enumerating the available styles in the solution. How can I do that? I thought I could use some custom property attributes, to tell VS that a given control's property is in ...

How to access a web custom control property from an editor
Hello !! my problem is the following ! I have a web custom control and it has two properties !! let us cal them prop1 and prop2 prop1 has an editor and every thing is fine ! in the editor method (EditValue) I want to get (prop2) value !!how can I make it ? Help yourself by helping otherswww.itgroup-sy.net hello asp.net professionals where r u ?Help yourself by helping otherswww.itgroup-sy.net...

When can i access a set property of a custom control?
I call the control on the page and it works fine. ie: <kas:btn val1="someValue" id="sp" runat="server" Text="Click Here" /> I am setting a public property called val1 which I can access in the onClick event in the controls logic, but nowhere else??? I'm trying to use this value to dynamically set an Attribute of the control (ie: this.Attributes.Add("onClick", script + val1). However, I am trying to get that value when the constructor is run:(I have also tried in the PreRender, OnIit, etc.) so in the constructor, say I ...

How do I make a Custom Property in my Custom Control into a Bindable Property
I've got a custom control in ASP.NET 2.0.  I want to bind one of its properties to data, but even though I specify the [ Bindable(true) ], before the property, the only property that shows up in the Data Bindings dialog is "visible". This is my code for the Custom Control:public partial class Offers_SearchTemplates_OfferSearchButton : System.Web.UI.UserControl{[Bindable(true)]public virtual string OfferUID{get{object objTitle = ViewState["OfferUID"];if (objTitle == null)return string.Empty;return (string)objTitle;}set{ViewState["OfferUID"] = value;...

Published properties and property editor... how to?
+Sorry if these questios are already answered.... i'm pretty sure i've seen somewhat related but after 40 mins of searching i'm unable to find it.+ Working with BDS2006 I have a component, derived from another not developed by me, that need to show some properties in the Inspector. They are: - FONT (the standard Font thing: the ancestor does not have this property, and basically i need to "expose" the Font of a TLabel. 2 pictures ("OnPicture" and "OffPicture"). I'm just unable to make these properties appears in the Object inspector, and ...

Component Properties All Properties tab
Is there a size/item limit to the Component Properties All Properties repository? I'd like to store (potentially hundreds) customer connection username/password information in this area. None we are aware of. Dave Wolf Internet Applications Division "David Short" <david.short@prescriber.com> wrote in message news:396A581C.2454F1DB@prescriber.com... > Is there a size/item limit to the Component Properties All Properties > repository? I'd like to store (potentially hundreds) customer > connection username/password information in this area. >...

Writing Property Editor
Hi all, I'm writing a Property editor in Delphi 2010. First I design and install it, after that close that package (Not closing delphi 2010) to test this editor. I opened a dummy project and put my component and click its property and my editor became visible. there is no problem untill here. So, I realized that something is wrong in editor. I close dummy project (Not closing delphi 2010) and open my property editor again, changed my codes and try to one of Compile, Buil or Install, compiler tell me that package bpl file can not be created and after that imm ediately gives too much...

i created a custom profile.. how can i access the property i created in web.config in dll?
i created some control in a dll, how can i access the profile property in the dll? You may take a look at this article found by andymac7:How to use the Profile feature outside an ASP.Net 2.0 applicationWelcome to my SQL/ASPNET forum for Chinese http://51up.org/bbs/forumdisplay.php?fid=38...

How to create component/property editors for FMX components?
Hi All, I've created (I hope :) ) a FireMonkey component. Now I want to create component editors and property editors. I know how to do it for VCL (include DesignIntf, DesignEditors, descend from TComponentEditor and TPropertyEditor and register them). How do you create component editors and property editors in FireMonkey though? Thanks, Tom > I've created (I hope :) ) a FireMonkey component. Now I want to create > component editors and property editors. I know how to do it for VCL > (include DesignIntf, DesignEditors, descend from TComponentEditor and > TPrope...

Property is not setting in custom control property
hi ,         I am adding an image control programmatically in a webpartzone which is adding successfully but the properties i am setting in image control are not setting .following is the code that i am using .the code 'img.ImageUrl = "~/images/atlas_title.jpg"     do not set the property in it.Dim webmgr As WebPartManager = WebPartManager.GetCurrentWebPartManager(Me)Dim img As New Web.UI.WebControls.Imageimg.ID = "Img"'img.ImageUrl = "~/images/atlas_title.jpg"     ...

Web resources about - Custom property editor that can access other properties of a component. - embarcadero.cppbuilder.writing

General Growth Properties - Wikipedia, the free encyclopedia
Chicago , Illinois , U.S. General Growth Properties, Inc. is an American real estate investment trust , headquartered at 110 North Wacker Drive ...

RentalRoost Brings Facebook Into Process Of Matching Up Home Seekers, Available Properties
... places to live , as RentalRoost , a San Francisco Bay-area-based website that incorporates Facebook data into its rankings of available properties, ...

Extended Profile Properties - Facebook-Entwickler
These Permissions cannot be revoked in the Login Dialog during the login flow, meaning they are non-optional for Users when logging into your ...

PortPerry Properties (@brian14mckinlay) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Hawaii Real Estate Properties for iPad on the App Store on iTunes
Get Hawaii Real Estate Properties for iPad on the App Store. See screenshots and ratings, and read customer reviews.

Qld climate change pilot study shows 4400 properties could flood in Townsville
The Queensland Government is silently preparing Queensland for an 80cm sea rise, which would impact tens of thousands of homes by the end of ...

Smart Buys: Sydney properties for less than $1 million
Domain's choice of smart Sydney properties this week.

Australian Federal Police raid properties in new CFMEU-linked investigation
Federal Police have raided properties as part of an investigation into a CFMEU organiser suspected by authorities of being bribed.

Nobody's home: Housing boom leaves swathe of empty properties
The nation's three-year property boom is leaving its biggest cities awash with empty homes, a report shows.

Queensland storms: Roofs ripped off houses in Warwick, 19,000 properties left without power
... roofs in Warwick, as wild storms move across south-east Queensland. More than a dozen homes have lost their roofs and close to 19,000 properties ...

Resources last updated: 12/17/2015 9:10:48 AM