Originally Posted by Minceraft
So, I was messing around with these, like you suggested:
Lua Code:
BOXUIBackdrop:ClearAnchors() BOXUIBackdrop:SetAnchorFill(BOXUI) --This one works like a charm!! Makes it the same size as the main window, like you said!-- --But then I tried to use this one to anchor the EditBox to the Backdrop.....-- BOXUIBox:ClearAnchors() BOXUIBox:SetAnchorFill(BOXUI) --it's expecting something instead of what it gets, I'm assuming, because it can't find it for some reason??--
|
woops, my bad. This is because when I wrote that I expected (which is my own fault) the editBox to be a child of the TLW, but it is not. Your editBox is a child of the backdrop so I typed the wrong name. You do not have any control named: BOXUIBox.
Your editBox control is a child of the backdrop and named $(parent)Box.
The backdrop is a child of the TLW and is named: $(parent)Backdrop
So your editBox control is really named: BOXUIBackdropBox
So the second part, anchoring the editBox should have looked like this:
Lua Code:
BOXUIBackdropBox:ClearAnchors()
BOXUIBackdropBox:SetAnchorFill(BOXUI)
Originally Posted by Minceraft
I get what you were saying about the anchors needing to be cleared, though, because they are still anchored to the last point I set!
So, I'm guessing the (0, 0) on the other format are x and y? That could be really handy in other situations, as well.
|
Yes the 0, 0 are the offsetX & offsetY from the anchor point.
Lua Code:
BOXUIBackdrop:SetAnchor(TOPLEFT, BOXUI, TOPLEFT, OffsetX, OffsetY)
Originally Posted by Minceraft
But what about SavedVariables? This is what I'm using to remember where the window is....
Lua Code:
function BOX.OnMoveStop( self ) BOX.settings.wndMain.x = self:GetLeft(); BOX.settings.wndMain.y = self:GetTop(); --These work for my other Addons but not this one... -- --the others are movable perfectly and they remain after ReloadUI-- BOX.settings.wndMain.width = self:GetWidth(); BOX.settings.wndMain.height = self:GetHeight(); end
What is the difference?And, I was looking around for examples of SavedVariable use but nothing seemed to match what I was needing...
|
I don't know what your asking when you say what is the difference. The difference between what and what? I don't see anything wrong with that code you posted to save settings.
From what I remember & what I see here, I did not see any problems with how you were handling the saved variables. You have to get them all anchored properly first or they won't work regardless of how your handling the saved variables because your only restoring the position of the TLW in your code, which is the only window you cant actually see. If the others are not anchored to the TLW they will not necessarily be in the same spot as the TLW, so it will look like your saved variables (restoring the windows position) is not working...but it really is because the TLW is where it is supposed to be, where you told it to be. Its the other windows (background & edit box) that are not where they are supposed to be (anchored to the TLW).