I've got a rather complicated action to populate a combobox.
The first thing is does is set everything to zero and then loop through mapspots, count them by group and return the numbers.
Problem #1 is that this calls the second action add_group_items() everytime it loops when it's only supposed to call it when it reaches the total number of mapspots.
Problem #2 is that when it populates the combox the text is all over the place, on different lines and a bit mental.
This works fine without the languages element added, however the problems are probably related.
Any ideas?
Code
<!-- Combobox Actions : initialise combobox-->
<action name="setupgroupcombobox">
trace(mapspot.count);
set(g,0);
set(streetcount,0);
set(destcount,0);
set(foodcount,0);
set(accomcount,0);
set(activcount,0);
set(transcount,0);
loop_all_group_items(get(g),get(mapspot.count));
</action>
<!-- Combobox Actions : loop mapspots and count groups-->
<action name="loop_all_group_items">
trace(%2);
if(mapspot[%1].group == street, inc(streetcount));
if(mapspot[%1].group == destination, inc(destcount));
if(mapspot[%1].group == food, inc(foodcount));
if(mapspot[%1].group == accommodation, inc(accomcount));
if(mapspot[%1].group == activity, inc(activcount));
if(mapspot[%1].group == transport, inc(transcount));
inc(g);
trace(g);
if(g LT %2, loop_all_group_items(get(g),%2));
if(g == %2, add_group_items(get(g),get(lang)));
</action>
<!-- Combobox Actions : get title languages and get data for combobox-->
<action name="add_group_items">
plugin[groupcombobox].removeall();
set(selectgroup,get(data[%2_select_group].content));
set(allviews,get(data[%2_allviews].content));
set(streets,get(data[%2_streets].content));
set(dest,get(data[%2_destinations].content));
set(food,get(data[%2_foodbeverage].content));
set(accom,get(data[%2_accommodation].content));
set(activity,get(data[%2_activities].content));
set(transport,get(data[%2_transport].content));
add_group_items_next(get(selectgroup),get(allviews),get(g),get(streets),get(streetcount),get(dest),
get(destcount),get(food),get(foodcount),get(accom),get(accomcount),get(activity),get(activcount),get(transport),get(transcount));
</action>
<!-- Combobox Actions : populate group combobox-->
<action name="add_group_items_next">
trace(%1_%2_%3_%4_%5_%6_%7_%8_%9_%10_%11_%12_%13_%14_%15);
plugin[groupcombobox].additem(%1,null);
plugin[groupcombobox].additem(%2:%3,loop_all_mapspot();setupcombobox());
plugin[groupcombobox].additem(%4:%5,loop_all_mapspot_groups(street));
plugin[groupcombobox].additem(%6:%7,loop_all_mapspot_groups(destination));
plugin[groupcombobox].additem(%8:%9,loop_all_mapspot_groups(food));
plugin[groupcombobox].additem(%10:%11,loop_all_mapspot_groups(accommodation));
plugin[groupcombobox].additem(%12:%13,loop_all_mapspot_groups(activity));
plugin[groupcombobox].additem(%14:%15,loop_all_mapspot_groups(transport));
</action>
Alles anzeigen