Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

component writing question, please help...

Hi all,
I would like to add a property to my component which will display a dropdown list of strings (like an enumarated property) that the user can choose in the appropriate field in the object inspector - design time. The thing is, i cant use enumarated property cause I get the list as a result of a database query, and i can only build the list of strings at run time.
can someone please explain how it can be acomplished? Ive looked everywhere for an example to learn from and didnt get an answer. any help will be welcomed, please help.
thanks Rotem.

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi all,
    : I would like to add a property to my component which will display a dropdown list of strings (like an enumarated property) that the user can choose in the appropriate field in the object inspector - design time. The thing is, i cant use enumarated property cause I get the list as a result of a database query, and i can only build the list of strings at run time.
    : can someone please explain how it can be acomplished? Ive looked everywhere for an example to learn from and didnt get an answer. any help will be welcomed, please help.
    : thanks Rotem.
    :
    :
    This is very difficult and potentially dangerous to do. You must write a new property editor, which opens the database and gets the strings during design-time. If the database does not exist the property editor must still provide the property with at least one value. Beware: you cannot use any of the database components, aliases, or other values in the project itself for this, because that would make the property dependent on a certain project layout, which might invalidate the component in lots of projects.
  • rotekitarotekita Member Posts: 2
    Thanks for the warning...
    I'm starting to realize that I might be planing something wrong...
    But maybe I should clarefy more.
    My plan is for the Database components to be a part of my component that inherates from TComboBox.
    But this is a smart component that is a part of a group of filter components which provide filtering to one another, and sometimes the template creator will choose an option at design time and make one filter component unvisible in the template.
    I can make him choose a string from the Items property and write it manually to the text property. But I prefer that he would be able to choose from a dropdown list like the one that apears when using an enumarated type property. The reason I think it's posible is because a list like that apears for example in prperties like Font/Name or DBDateSet/DataBaseName. It will be great if someone can tell me if it's posible and if so than how should I get it done.
    Thanks in advance,
    Rotem.

Sign In or Register to comment.