Forum > LCL

Can't get Item's Text property

(1/2) > >>

fafastrungen:
Hi, I'm making an unit to translate applications made with Lazarus.
I save in an ini file all captions, hints and text value and then I set them automatically using SetPropValue function.
But before set properties values, I have to find them and I do it using GetPropList function.

This is an example:
Count := GetPropList(comboBox, PropList);

This works perfectly, finds every combobox's property, but the next example does not work:
Count := GetPropList(comboBox.Items, PropList);

It return nothing, and the property ("Text") I have to set is owned by Items, not combobox.

In short, what I need is to find the "Items.Text" property, not the "ComboBox.Text" property.

Thanks in advance.

DirkS:
According to the docs GetPropList returns a list with published properties (http://www.freepascal.org/docs-html/rtl/typinfo/getproplist.html). TStrings (the type of 'Items') does not have any published props.

Gr.
Dirk.

JuhaManninen:

--- Quote from: fafastrungen on February 28, 2011, 08:49:53 pm ---Hi, I'm making an unit to translate applications made with Lazarus.

--- End quote ---

You mean translating the GUI texts?
"resourcestring" is the way to go:
 http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs

Juha

fafastrungen:
Thank you both, very helpful.

fafastrungen:
Is there a way to assign ComboBox.Items.Text property at run time ?
I store in a xml file all properties I want to assign, for example:

...
<comboBox>
  <items text="Item 1\nItem 2" />
</comboBox>
...

I search for "comboBox" component, if I found it I search for "Items" property, if I found it I try to assign property using SetPropValue, but I can't assign it because "Items" has no published "Text" property, so how can I assign it ?

Navigation

[0] Message Index

[#] Next page

Go to full version