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
0
John
2/28/2014 8:58:37 PM
public.delphi.vcl.writing 510 articles. 0 followers. Follow

1 Replies
1284 Views

Similar Articles

[PageSpeed] 45

John wrote:

> 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.

Override the virtual GetAttributes() method to include the paValueList flag 
in the output.  Override the virtual GetValues() method to provide the desired 
values.  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}
procedure TMyPropEditor.GetAttributes: TPropertyAttributes;
begin
  Result := inherited GetAttributes + [paValueList];
end;

procedure TMyPropEditor.GetValues(Proc: TGetStrProc);
var
  Comp: TMyComponent;
begin
  Comp := TMyComponent(GetComponent(0));
  // use Comp as needed, calling Proc() for each desired value ...
end;
{code}

--
Remy Lebeau (TeamB)
0
Remy
3/1/2014 12:12:23 AM
Reply:

Similar Artilces:

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 John wrote: > How do I design a custom property editor that can access a property > of a compo...

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 ...

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...

Delphi VCL components properties history articles
Hi, i would like to know where i can found Delphi VCL components properties history information because i need to know from wich Delphi version a property exists or from wich version a protected procedure was marcked with "virtual" command from a standard component. Thanks, Maurício "Julio Pião" <=?Utf-8?Q?Julio_Pi=C3=A3o?=> wrote in message news:292952@forums.embarcadero.com... > i would like to know where i can found Delphi VCL components > properties history information AFAIK, that kind of list does not exist anywhere. > 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;...

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. >...

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 ...

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...

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"     ...

Editing PB Component Properties adds com.sybase.jaguar.component.iso_level property
Whenever we use Jaguar Manager (EAS 4.2.2) to set a component property on a PowerBuilder component the following property is appended automatically: com.sybase.jaguar.component.iso_level=serializable From what I read on a Sybase document the property creates problems. Anyone experiencing this? TIA A. This is a multi-part message in MIME format. --------------090406010200000407040509 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Aggelos Paraskevopoulos wrote: > Whenever we use Jaguar Manager (EAS 4.2.2) to set a component ...

Attaching a property editor to a UnicodeString property, XE3
Like subject states, I'm trying to attach a custom property editor to a published UnicodeString property. What I've done, is following the example as listed in the help for RegisterPropertyEditor. Specifically, I've added the following: {code} PTypeInfo TypeInfo; PPropInfo PropInfo =GetPropInfo(__typeinfo(TForm), "BorderStyle"); if (PropInfo) TypeInfo = *(PropInfo->PropType); {code} and changed "BorderStyle" to "Caption, since I want the delphi type info for a string, and not an enumerated type. The help file clearly states that this met...

Web resources about - Custom property editor accessing other component properties - public.delphi.vcl.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.

Fluffy buyback extended to neighbouring properties that share a wall
... Fluffy buyback and demolition Chief Minister Andrew Barr extended the Fluffy buyback and demolition scheme on Tuesday to include some properties ...

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

One missing as bushfire threatens properties north of Lancefield, central Victoria
UPDATE: AN elderly man is missing as crews work to protect rural properties under threat from a 3000ha bushfire that continues to burn out of ...

Golden Mile a 'basketcase' as commercial properties lose value
Kings Cross will never again function as Sydney's late-night entertainment precinct, property owners say, with residential developers snapping ...

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/6/2015 8:13:21 PM