Thread Tools Display Modes
01-13-15, 07:46 AM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Mystery of the Disappearing X

My add-on has this frame which has a little X in the corner to close it.
The frame shows automatically on login.
When I just login, everything's fine. When I /reload, however, the X does not show. It's there, it's clickable, it works, but it's invisible.
I can make it visible again by changing its text.
Does anybody have any idea what the hell?



Lua Code:
  1. f.btnX = CreateFrame ("EditBox", nil, f)
  2. f.btnX:SetPoint ("TOPRIGHT", f, "TOPRIGHT")
  3. f.btnX:SetSize (10,12)
  4. f.btnX:SetTextColor (1.0,0.77,0.27,1.0)
  5. f.btnX:SetTextInsets (0, 0, 2, 2)
  6. f.btnX:SetFont ("Fonts\\FRIZQT__.TTF", 11)
  7. f.btnX:SetAutoFocus (false)
  8. f.btnX:Disable ()
  9. f.btnX:SetText ('x')
  10. f.btnX:SetScript ("OnMouseDown", function (self, button)
  11.     f:Hide ()
  12. end)
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
01-13-15, 08:10 AM   #2
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
f:Show() before the onclick? also what's f.btnX: Disable()?
  Reply With Quote
01-13-15, 08:14 AM   #3
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
It's pretty old recycled code, but IIRC I'm using an EditBox instead of, err, anything that makes sense, because I used to have problems with the click events, and Disable just means it's not used as an actual text box that you can focus and edit.
And :Show doesn't help, since technically it is already shown.

[Edit]
I've replaced it with a proper button for now just so I can push a new version, but I'm still curious about what caused this problem.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!

Last edited by Malsomnus : 01-13-15 at 09:09 AM.
  Reply With Quote
01-13-15, 04:01 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Sounds like its frame level is below some other texture on your frame?

Could just be covered up.

Alternatively, since it's an edit box your text may just be getting cleared.

Last edited by semlar : 01-13-15 at 04:03 PM.
  Reply With Quote
01-13-15, 05:50 PM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I came to this thread expecting a thrilling Twilight_Zone story about the "Mystery of the Disappearing X". And now this. How disappointing.
  Reply With Quote
01-13-15, 08:00 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Wait, wait, wait... Why are you using an editbox to close your frame?

/edit: okay, so I read the rest of the thread. But my mind was totally blown by ^^^ that I couldn't focus on anything afterward.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-13-15, 09:10 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Yeah that is pretty WTF usage of an editbox...

Code:
local close = CreateFrame("Button", nil, self, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT")
You don't even need any scripts since the template already comes with one; just make sure "self" is the frame to be closed when clicking.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-13-15, 11:16 PM   #8
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Phanx View Post
Yeah that is pretty WTF usage of an editbox...

Code:
local close = CreateFrame("Button", nil, self, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT")
You don't even need any scripts since the template already comes with one; just make sure "self" is the frame to be closed when clicking.
This is a fine solution for a different problem
(That's what I ended up using, of course, but I really hate the way this button looks)
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
01-13-15, 11:49 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Malsomnus View Post
(That's what I ended up using, of course, but I really hate the way this button looks)
Why? It's what every other close button in the WoW UI looks like. Best to be consistent.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-14-15, 12:07 AM   #10
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Phanx View Post
Why? It's what every other close button in the WoW UI looks like. Best to be consistent.
I'm all for the default UI and all, but for most of what I do it's just too bulky.
And the Mystery of the Disappearing X is still being mysterious
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
01-14-15, 12:17 AM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, you already know what I'm going to say -- show me all of your code. Can't draw any conclusions from an isolated snippet.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-14-15, 06:27 AM   #12
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
I've encountered issues with editboxes being empty before. Think it worked when I first hid the parent frame or something.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
01-14-15, 01:55 PM   #13
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Lombra View Post
I've encountered issues with editboxes being empty before. Think it worked when I first hid the parent frame or something.
That's right, I used to hide this frame on creation and show it later, and removing that bit is one of the changes around the time the bug appeared... interesting
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
01-14-15, 06:39 PM   #14
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
So you're using an EditBox just to display text and respond to clicks. Isn't this what a standard Button object is for? I usually would go for using the UIPanelCloseButton template like every other close button in the game, but this would be the equivalent to your original code using proper UI objects.

Lua Code:
  1. f.btnX=CreateFrame("Button",nil,f);
  2. f.btnX:SetPoint("TOPRIGHT");
  3. f.btnX:SetSize(10,12);
  4. f.btnX:SetNormalFontObject("GameFontNormal");
  5. f.btnX:SetText('x');
  6. f.btnX:SetScript("OnClick",function() f:Hide(); end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Mystery of the Disappearing X


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off