Talk:API UIObject GetName

Under what conditions would this function fail or return nil? This is happening to me, and I'm getting an error:

Date: 2008-06-24 16:35:37 ID: 51 Error occured in: Global Count: 1 Message: ..\FrameXML\UIPanelTemplates.lua line 39: attempt to concatenate local 'tabName' (a nil value) Debug: [C]: ? ..\FrameXML\UIPanelTemplates.lua:39: PanelTemplates_TabResize [string "*:OnShow"]:1: [string "*:OnShow"]:1 [C]: CreateFrame test\test.lua:103: testcreateauctiontab test\test.lua:386: test_OnEvent [string "*:OnEvent"]:1: [string "*:OnEvent"]:1

It would return nil if the region doesn't have a name. Names only get assigned during CreateFrame calls or XML declarations, and they are completely optional. Obviously you've seen that variables can still point to the region (you could not have called this function otherwise), but variables ~= names.

If I had to guess what was happening in your particular case, I would say that you created a frame and asked the Blizzard-provided functions to treat it like a tab, BUT the frame that you created omits structure that Blizzard expects and that you were unaware of. It's like what would happen if you wanted something to act like a button, but that something possesses neither Text nor Icon nor BoundingBox, or any of the other pieces that assemble the whole.

The solution then may lie in copying from something that already works. Find an object that behaves pretty much like what you're trying to create, then thoroughly hunt down all the code that constructs it. Copy everything, and alter the parts that don't look like your vision. Once you have something that is bug-free, you can pare down what you don't need. Or, you could do what thousands of people that are smarter than me do, and Read The Friendly Manual on tabs. 22:15, 24 June 2008 (UTC)