|
EControl Ltd. VCL libraries and software support forum
|
View previous topic :: View next topic |
Author |
Message |
aecspades
Joined: 04 Dec 2006 Posts: 14
|
Posted: Tue Jan 09, 2007 1:33 pm Post subject: Open TInspectorList categories at run-time |
|
|
Is there a way to programmatically ‘open’ a property category at run-time in a TInspectorList component? For example, using EC_NO_BPL;NEWNEWDESIGNER;EC_DSN_REG;EC_REG conditionals I have code that adds the most-used properties to a category called ‘Common’:
RegisterPropertiesInCategory('Common', ['Active', 'Align', 'Caption', 'Connection', 'DataSet', 'DataSource', 'Font', 'Items','Lines', 'Name', 'Picture', 'Text']);
In the TInspectorList component, I have set the ByCategories property to true. Right now, when I drop a new component on the form all of the categories correctly show, but they are all collapsed. What I’d like is some way to open the ‘Common’ category (it should always be there because of the Name property) either through a method call or maybe a ‘DefaultCategoryName’ property that could be added to the TInspectorList component (which would, by default, open that category name when present).
I’ve looked through the documentation and can’t see anything similar. Please let me know if it is possible or if you would consider this as a possible enhancement. |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Wed Jan 10, 2007 7:47 am Post subject: |
|
|
Add to public of TCustomInspectorList:
Code: | property Nodes: TPropertyNodes read FNodes; |
After that you may use next code to expand 'Common' category:
Code: | with InspectorList1 do
for i := 0 to Nodes.Count - 1 do
if (Nodes[i] is TCategoryNode) and (Nodes[i].Name = 'Common') then
Nodes[i].Expand; |
Michael. |
|
Back to top |
|
|
aecspades
Joined: 04 Dec 2006 Posts: 14
|
Posted: Wed Jan 10, 2007 1:52 pm Post subject: Open TInspectorList categories at run-time |
|
|
Works great! I added the code to the OnPropListUpdated event:
Code: | with InspectorList1 do
// Nodes seems to be null when the form gets closed...
if Nodes<>nil then
for i := 0 to Nodes.Count - 1 do
if (Nodes[i] is TCategoryNode) and (Nodes[i].Name = 'Common') then
begin
Nodes[i].Expand;
exit;
end; |
I had to deal with a null Node when the form was closed or I got an Access Violation. If there is a better place to put the code (I'm using a modified version of the FormWithParent demo) or if that is the wrong way to deal with the null node, please let me know. Otherwise, thank you very much.
P.S. please consider adding the Nodes property as a future enhancment idea so I don't have to change the code every time a new version is released. Thanks again. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|