There are two places I'd like to be able to use icons. Nothing clickable or otherwise special, just there. In one case the icon is its own texture path and can be displayed with |T embedded in text. The other case requires a subset of a texture, using SetTexCoord, which cannot be done with |T. I'm going to try grabbing the particular st buttons and then using a CreateTexture/SetTexture/SetTexCoord sequence.
It looks like I could also use the DoCellUpdate member, maybe, but clicking on the link at http://www.wowace.com/addons/lib-st/pages/set-data/ for "DoCellUpdate" gets me a 403 error. I think I'm figuring it out from the Core.lua code though.
The bad news is using |t is terrible. There's padding that I couldn't seem to control around the icons.. and it just ended up looking bad...
The good news is providing a custom DoCellUpdate function isn't too bad, and lets you position textures perfectly. See this link. On the right hand side with the gear icons is a lib-st table. The icon cells also have a hover-over for displaying a tooltip.
It looks like I could also use the DoCellUpdate member, maybe, but clicking on the link at http://www.wowace.com/addons/lib-st/pages/set-data/ for "DoCellUpdate" gets me a 403 error. I think I'm figuring it out from the Core.lua code though.
I fixed the link. I did have a page for DoCellUpdate. There's not a TON of information about it yet, but I did have a page, the link was just broken :)
Good to know, thanks. That's not obvious from the documentation. Perhaps you could include Refresh on the API page, and mention the above on the SetData page?
edit: actually, Refresh doesn't draw anything; SortData draws the table (but seems a misnomer since I'm not sorting by any field ever).
Right... well... because of the way sorting works ( it doesn't actually sort your table, it makes a sort-reference table ) You must call it when the data changes... I think refresh used to work back before I made sorting... it's been a while. I know you don't sort... but if you add data to the table I don't think you'll get the needed references in the sort table... that might be something I could fix... I'll have to think about that one. In the mean time, just call SortData after each addition ( or group of additions, if possible )
The bad news is using |t is terrible. There's padding that I couldn't seem to control around the icons.. and it just ended up looking bad...
I ended up using |T for the first case, because doing it any other way would have been a serious pain.
I did eventually figure out how to use a custom DoCellUpdate from looking at Core.lua, and now I'm creating textures attached to the button frames that ST already creates. As more people do this kind of thing, I'm sure some kind of semi-standard routine will evolve.
I fixed the link. I did have a page for DoCellUpdate. There's not a TON of information about it yet, but I did have a page, the link was just broken :)
Right... well... because of the way sorting works ( it doesn't actually sort your table, it makes a sort-reference table ) You must call it when the data changes... I think refresh used to work back before I made sorting... it's been a while. I know you don't sort... but if you add data to the table I don't think you'll get the needed references in the sort table... that might be something I could fix... I'll have to think about that one. In the mean time, just call SortData after each addition ( or group of additions, if possible )
Additional note: a lot of the other ST functions are coded to call ST:Refresh, which can be hooked by the user. This doesn't help as much as it could, because SortData calls DoFilter (which actually adds the lines), and then SortData calls the (possibly hooked) Refresh. So hooking Refresh to (say) update the data table falls short, because it doesn't call SortData/DoFilter. And if the hooked Refresh calls SortData, it causes an infinite loop. (Setting and then clearing a flag around the call to SortData would be required, but that starts leading down an ugly path.)
It's not under active development or maintenance as far as I know, but it still works the same as it ever did. I use it in a couple of my addons, and it definitely takes some getting used to, but works fine.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
http://www.wowace.com/addons/lib-st/tickets/2-icons-in-table/
There are two places I'd like to be able to use icons. Nothing clickable or otherwise special, just there. In one case the icon is its own texture path and can be displayed with |T embedded in text. The other case requires a subset of a texture, using SetTexCoord, which cannot be done with |T. I'm going to try grabbing the particular st buttons and then using a CreateTexture/SetTexture/SetTexCoord sequence.
It looks like I could also use the DoCellUpdate member, maybe, but clicking on the link at http://www.wowace.com/addons/lib-st/pages/set-data/ for "DoCellUpdate" gets me a 403 error. I think I'm figuring it out from the Core.lua code though.
The good news is providing a custom DoCellUpdate function isn't too bad, and lets you position textures perfectly. See this link. On the right hand side with the gear icons is a lib-st table. The icon cells also have a hover-over for displaying a tooltip.
Here is an example from the dkp mod where I use it.
I fixed the link. I did have a page for DoCellUpdate. There's not a TON of information about it yet, but I did have a page, the link was just broken :)
Right... well... because of the way sorting works ( it doesn't actually sort your table, it makes a sort-reference table ) You must call it when the data changes... I think refresh used to work back before I made sorting... it's been a while. I know you don't sort... but if you add data to the table I don't think you'll get the needed references in the sort table... that might be something I could fix... I'll have to think about that one. In the mean time, just call SortData after each addition ( or group of additions, if possible )
I ended up using |T for the first case, because doing it any other way would have been a serious pain.
I did eventually figure out how to use a custom DoCellUpdate from looking at Core.lua, and now I'm creating textures attached to the button frames that ST already creates. As more people do this kind of thing, I'm sure some kind of semi-standard routine will evolve.
Aha, now I see it. Thanks!
Yeah, I'm calling sortdata with a comment. :-)
Additional note: a lot of the other ST functions are coded to call ST:Refresh, which can be hooked by the user. This doesn't help as much as it could, because SortData calls DoFilter (which actually adds the lines), and then SortData calls the (possibly hooked) Refresh. So hooking Refresh to (say) update the data table falls short, because it doesn't call SortData/DoFilter. And if the hooked Refresh calls SortData, it causes an infinite loop. (Setting and then clearing a flag around the call to SortData would be required, but that starts leading down an ugly path.)