Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

User should change the name of a object

edited March 2007 in General
Hello,
in some cases the user should to be able to change the Name of a
printable object. I mean not the property UserName but the property
Name. The property Name I can't change with the object inspector.

And the function Rename in the Report Tree only change the UserName.

What can I do that the user has the ability to change the Object Name?

Best wishes
Bernhard

Comments

  • edited March 2007

    By design, at run-time the user can only change the UserName property.
    Throughout the report designer the UserName is displayed, rather than the
    name. Run-time code, RAP, uses the UserName to refere to objects instead of
    the name.

    From the Delphi online help for the Name property: "Changing Name at runtime
    causes any references to the old name to become undefined. Any subsequent
    code that uses the old name will cause an exception."

    Thus we introduced the concept of UserName.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2007
    Nard Moseley (Digital Metaphors) schrieb:

    This I understand. But nevertheless I need the ability for the end user
    to change the Name property.

    Is there a way to extend the Object Inspector with own properties? If
    so, where can I find an example?

    Is there a event if the user change the UserName property, so I can set
    the Name property to the UserName property in special cases?

    Best wishes
    Bernhard
  • edited March 2007

    The object inspector categories can be configured easily, here is an example
    of removing the Name property from the Ignore category and adding it to the
    Identity category.


    uses
    ppInspector;

    procedure TForm1.ConfigureObjectInspector;
    var
    lCategory: TppPropertyCategory;
    liIndex: Integer;
    begin

    // remove Name from the Ignore property category
    lCategory :=
    TppPropertyCategoryManager.PropertyCategories.ItemByName['Ignore'];

    liIndex := lCategory.PropertyNames.IndexOf('Name');

    if liIndex >= 0 then
    lCategory.PropertyNames.Delete(liIndex);

    // add Name to the Identity property category
    lCategory :=
    TppPropertyCategoryManager.PropertyCategories.ItemByName['Identity'];

    lCategory.PropertyNames.Add('Name');
    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2007
    Thanks, this works fine.
    Best wishes
    Bernhard

    Nard Moseley (Digital Metaphors) schrieb:
This discussion has been closed.