How to gain access to the property Items of a TComboBox, that is inside of a TStyleBook?

How to gain access to the property Items of a TComboBox, that is inside of a TStyleBook?
Usually I access to certain properties like this
TreeNode.StylesData['ComboBoxPROPERTY_VALUE.Visible'] := True;
When I need to assign an event handler to a component inside a TStyleBook, I use this format
TreeNode.StylesData['ComboBoxPROPERTY_VALUE.OnChange' ] := TValue.From
But now I need to assign the list of posible values to this ComoBox and things like these
lStrings := TStrings(TreeNode.StylesData['ComboBoxPROPERTY_VALUE.Items']);
or
TreeNode.StylesData['ComboBoxPROPERTY_VALUE.Items'].Add(Splitted[i]);
Don't compile, with errors like "Invalid typecasting" or "undeclared identifier".
Any one of you have experience with TStyleBooks, and can help me.
Thanks in advance.
I finally found the solution.
ReplyDeleteComboBox := TComboBox(TreeNode.FindStyleResource('ComboBoxPROPERTY_VALUE'));
Splitted := Item.VALUE_RANGE.AsString.Split([',']);
for i := 0 to Length(Splitted) -1 do begin
ComboBox.Items.Add(Splitted[i].Trim);
end;
Any way, thank you to all!!!!
Out of interest, why do you go through Styles to assign values to a combobox?
ReplyDeleteAs you can see in the new image, I need to add Properties to each Item.
ReplyDeleteIn dependency of the type of the property I show a different component at the TListBoxItem. And of course, each property can have his own list of posible values. Is because of this, that I need to load the Items property, for each ItemProperty at runtime.
Don't hesitate to ask more if you think it was usefull.
Thanks.
https://plus.google.com/photos/...
Juan C. Cilleruelo Thanks for the tips and for sharing the image
ReplyDelete