sandsound
The code (c++) below is what I’m using to generate a inventory listview.
Is there a better way to make indentation in a listview?
/// loop through inventory items and add to listview if there is one or more
for (int i=0; i < item_count; i++)
{
if (item_num[i] > 0)
{
auto* text = new Text(context_);
text->SetStyleAuto();
/// get string lenght and add spaces to make all equal length
int str_length = strlen(item_name[i]);
std::stringstream ss;
ss << item_name[i];
for (int i=0; i < (18 - str_length); i++)
{
ss << " ";
}
/// add item amount last
ss << item_num[i];
text->SetText(ToString(ss.str().c_str()));
text->SetName(ToString(item_name[i]));
list_name->AddItem(text);
}
}
btw. it looks like this: