Thread Tools Display Modes
01-12-10, 06:47 PM   #1
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Checkbutton template bugged?

Been noticing an odd behavior while I was building the GUI for DCam.

Blue Arrow: In-game pointer
Gray Box: Area registering as checkbox highlighted




I double checked this behavior with CFM's checkbuttons, found the same result:



I've never noticed this behavior when I completed CFM's GUI, although that doesn't mean it wasn't there since I never had anything else to the right of them.

Tests
Together, other addons disabled: same
CFM alone: same
DCam alone: same
Remove "SetScale(.75)": same
Readjust Label fontstring lengths: same

[u]Notes[/u[
1) Other checkbuttons (2nd, 3rd, etc. in row) in DCam config highlight at proper distance when continuing from edge of first button
2) Behavior consistent down the rows

2 Possibilites
1) I screwed up the code somewhere (most likely )
2) There's a bug in Blizz's template.

If someone could take a look, it'd be appreciated. CFM's checkbox code is a bit neater to read, so I'll post that.

lua Code:
  1. fs = f:CreateFontString("CFM_ConstrainText")
  2.         fs:SetFontObject("GameFontGreenSmall")
  3.         fs:SetJustifyH("RIGHT")
  4.         fs:SetWidth(90)
  5.         fs:SetText("Width = Height?")
  6.         fs:SetPoint("TOPLEFT", CFM_HideText, "BOTTOMLEFT", 0, -4)
  7.        
  8.     cb = CreateFrame("CHECKBUTTON", "CFM_ConstrainButton", CFM_Config, "OptionsCheckButtonTemplate")
  9.         cb:SetPoint("LEFT", CFM_ConstrainText, "RIGHT", 10, 0)
  10.         cb:SetScale(.75)
  11.         cb:SetScript("OnClick", function()
  12.             if selFrame == nil or selFrame == "" then
  13.                 print("Please select a frame first.")
  14.                 return
  15.             elseif this:GetChecked() == 1 then
  16.                 activeProfile[selFrame].sameXY = true
  17.             else
  18.                 activeProfile[selFrame].sameXY = false
  19.             end
  20.             end)
  Reply With Quote
01-12-10, 06:49 PM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
That's normal actually (because it expects there to be text to the right which should be clickable, I guess). See http://www.wowwiki.com/API_Frame_SetHitRectInsets

Last edited by Akryn : 01-12-10 at 06:52 PM.
  Reply With Quote
01-12-10, 06:52 PM   #3
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Akryn View Post
Odd. Then why do the rest of the buttons to the right of the first function fine and don't have the "extended" right edge?

EDIT: Adding a quick cb:SetHitRectInsets(0, 0, 0, 0) fixed it. Thanks. Can't believe I didn't notice this until now.

Also thought about how the frames would "overlap" their right edges and answered my own question.

Last edited by Sythalin : 01-12-10 at 07:15 PM.
  Reply With Quote
01-12-10, 06:59 PM   #4
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by ChaosInc View Post
Odd. Then why do the rest of the buttons to the right of the first function fine and don't have the "extended" right edge?
Not sure; I've never made a checkbox with that template that didn't do that. I assumed it was part of it, but haven't looked TBH. Are you sure some other frame isn't on top of the hitbox of the other checkboxes?
  Reply With Quote
01-12-10, 07:14 PM   #5
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Akryn View Post
Not sure; I've never made a checkbox with that template that didn't do that. I assumed it was part of it, but haven't looked TBH. Are you sure some other frame isn't on top of the hitbox of the other checkboxes?
Think of it like a stack. Poor PS visual for ya to wrap around.

3 different buttons:


All are the same length/height (work with me here, I drew it in 2 min ). Now overlap them:



The right appear to be fine, but they're just hiding under each other.

EDIT: Now I get the fun of clearing the rest of the checkboxes in the row via clicking the preferred one. Tricky one that is...

Last edited by Sythalin : 01-12-10 at 07:20 PM.
  Reply With Quote
01-12-10, 07:23 PM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Rofl, I only have one addon that used check boxes and all of them have text beside them so, yep, never come across the problem rofl. Hmm, unless I added the text because of it. Was a long time ago
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
01-12-10, 07:38 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Yeah, this is because Chaos is using the template. You can also create a checkbox using your own code.
__________________
"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-12-10, 07:44 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by Seerah View Post
Yeah, this is because Chaos is using the template. You can also create a checkbox using your own code.
So do I, I just always set text against it automatically

Code:
SGW.Frames.AddCheckBox = function(name,parent,text)
        local checkbox = CreateFrame("CheckButton",name,parent,"OptionsCheckButtonTemplate");
        _G[checkbox:GetName().."Text"]:SetText(text);
        return checkbox;
end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
01-12-10, 09:49 PM   #9
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Seerah View Post
Yeah, this is because Chaos is using the template. You can also create a checkbox using your own code.
I tried that. I broke stuff. Maybe again down the line.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Checkbutton template bugged?


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