2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2022-11-09 04:44 PM
Hello everyone,
I've been working my way through the "Dialog Manager" Doc and the example addons provided by Graphisoft.
In the DG_Test AddOn is an example for a ListBox called "OwnerDrawnListBoxPalette.cpp". There is a function called "GetObjects()":
As I understand, the function clears the Items in the ListBox and fills it again. But how exactly does listBox.AppendItem() work?
ACAPI_Element_GetElemList (API_ZombieElemID, &data.elements) gets an elementlist, where data is a struct and data.elements is a GS::Array<API_Guid>.
So if we iterate in the for loop over the size of the GS::Array, how does "listBox.AppendItem ()" know which item to add? In the header file I saw it doesn't take any parameters (void), so I'm even more confused on how this function is supposed to work.
Dear Regards
Dayiz
Solved! Go to Solution.
2022-11-10 03:51 PM
Hi Dayiz,
"listBox.AppendItem ()" adds an item to the end of the list box. So in the example you posted, for each iteration of the loop there is a new item added to the list box and then you can reference this item immediately with "DG_LIST_BOTTOM" (there is also "listBox.BottomItem") which will always point to the currently last item.
In the end the loop body was executed exactly so many times as the size of the GS::Array, so the listBox will have that amount of items.
Best,
Bernd
2022-11-10 03:51 PM
Hi Dayiz,
"listBox.AppendItem ()" adds an item to the end of the list box. So in the example you posted, for each iteration of the loop there is a new item added to the list box and then you can reference this item immediately with "DG_LIST_BOTTOM" (there is also "listBox.BottomItem") which will always point to the currently last item.
In the end the loop body was executed exactly so many times as the size of the GS::Array, so the listBox will have that amount of items.
Best,
Bernd
2022-11-21 05:18 PM
I was confused how empty Items in a listbox can get their value. But now that i figured out how the update function for list boxes works, the append function makes sense.
thank you 🙂