PDA

View Full Version : category selection control



Sorcerer
August 14th, 2011, 09:15
Is there any method that can be used to count the number of categories present in a windowlist?

I would like to be able to resize the window so that all category tabs are always displayed when the containing window is opened - currently it is not always obvious that there are extra tabs that are hidden off the edge of the window.

Zeus
August 14th, 2011, 11:14
How about looping through the database nodes using ipairs and count/comparing the category nodes e.g.



local count = 0;
for k,v in pairs (getDatabaseNode().getChildren()) do
if v.getName() == "category" then
count = count + 1;
end
end

Sorcerer
August 14th, 2011, 11:40
Hi DrZ thanks for the reply.

I tried something similar before, but it appears category nodes are not counted as children. The above would return 0

if you do something like print(DB.findNode("encounter").getChildCount())
the number returned matches the number of encounters the categories appear to be ignored.

Zeus
August 14th, 2011, 12:16
Hmm, not sure then. I guess you would have to request an API change. i.e. something like access methods for windowlists like

- getCategories() returns a table of strings
- getCategoryCount() returns integer count of categories

Sorcerer
August 14th, 2011, 12:21
Yeah thats what I figured, but I think M_W probably has enough on his plate without working on something with such limited use.

I just wondered if anyone had found a workaround.
Its not really a big issue.

anyway thanks for your help.