Thread Tools Display Modes
10-09-15, 11:41 AM   #1
chanceboon
A Murloc Raider
Join Date: Oct 2015
Posts: 5
Another hopefully stupid one

Lua Code:
  1. myCheckButton = CreateFrame("CheckButton", "myCheckButton_GlobalName", myFrame, "ChatConfigCheckButtonTemplate");  
  2.     myCheckButton:SetPoint("TOPLEFT", 5, -150);
  3.     myCheckButton_GlobalNameText:SetText("1");
  4.     myCheckButton.tooltip = "1 Health.";

Using this code I can create the checkbutton, but the click-range on it is really distant...What I mean is that I can click to activate the button from an inch away on the screen. This basically means that I can't put a second check button beside this one because it sits in the zone that clicks the first button...hopefully I'm being clear.

Thanks again. Sorry for being a pain.
  Reply With Quote
10-09-15, 12:06 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
You can try something like myCheckButton:SetHitRectInsets(0,0,0,0) to adjust its hitbox.
  Reply With Quote
10-10-15, 02:09 AM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
ChatConfigCheckButtonTemplate and other Blizzard checkbox templates include a wide clickable area to the right of the checkbox where the label text would normally sit. Your label text is only one letter, but the templates are designed for the longer phrases used in the Blizzard option panels.

The function Semlar posted will reset the clickable area to just the size of the checkbox.

Also, I don't know how real the code you posted is, but you should make your "myCheckButton" variable local there, by sticking a "local" keyword in front of the first line. Otherwise, you're not only creating a global named "myCheckButton_GlobalName" (which is good for example code, not so good for real code; if you need to give your frames global names, give them names that identify the addon they belong to, like "ChanceboonsAddon_CheckButton") but also another global named "myCheckButton" that points to the same object.
__________________
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

WoWInterface » Developer Discussions » Lua/XML Help » Another hopefully stupid one

Thread Tools
Display Modes

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