Hi, this is going to sound really silly, but I've completely forgotten how to have an inventory item's name appear in a label on a mouseover!
Under repeatedly_execute_always, I inserted this line:
InventoryItem*item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
And then later on in the same function I say,
lblInvDescription.Text=item.Name;
This causes crashes and sadness, and I'm clearly missing the big picture. What is the correct way of doing this?
Thanks!
Quote from: KodiakBehr on Mon 20/05/2013 14:35:10
InventoryItem*item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
And then later on in the same function I say,
lblInvDescription.Text=item.Name;
This causes crashes and sadness, and I'm clearly missing the big picture. What is the correct way of doing this?
InventoryItem.GetAtScreenXY may return null, that's why you should test "item" pointer against one:
if (item != null)
lblInvDescription.Text=item.Name;
else
lblInvDescription.Text="";
That did the trick. Thanks a lot!