Thread Tools Display Modes
11-21-08, 05:16 AM   #1
Rabbit007
A Black Drake
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 81
Something Wrong With My Code? Help Appreciated :)

Well... i am starting to get the hanf of this rather well and I am learning how to move Elements of the UI and to parent them and what not. The issue I am having right now is I am moving the MicroMenu Buttons and setting them at different points on the frame.

What i am doing with them is setting the micromenu buttons spaced between a

-240 to 240 pixel area but some of the buttons are wanting to stick together like a Sticky code is happening kinda like in Dominios (where you can choose to have or not have sticky frames).

Screenshot Below



Here Is the code

------Micro Menu------

MainMenuBar:Hide()

local a = CharacterMicroButton
local b = SpellbookMicroButton
local c = TalentMicroButton
local d = AchievementMicroButton
local e = QuestLogMicroButton
local f = SocialsMicroButton
local g = PVPMicroButton
local h = LFGMicroButton
local i = MainMenuMicroButton
local j = HelpMicroButton

a:ClearAllPoints()
a:SetParent(Kranix)
a:SetPoint("BOTTOM",-240,0)
a:Show()

b:ClearAllPoints()
b:SetParent(Kranix)
b:SetPoint("CENTER",a,"RIGHT",53.3,0)
b:Show()

c:ClearAllPoints()
c:SetParent(Kranix)
c:SetPoint("CENTER",b,"RIGHT",53.3,0)
c:Show()

d:ClearAllPoints()
d:SetParent(Kranix)
d:SetPoint("CENTER",c,"RIGHT",53.3,0)
d:Show()

e:ClearAllPoints()
e:SetParent(Kranix)
e:SetPoint("CENTER",d,"RIGHT",53.3,0)
e:Show()
As you can see they should be setting themselves apart by 53.3 pixels from the button before it. I know it isn't matching the -240 to 240 pixels perfectly but it was 53.3 repeating and is a very minimal differance to the eye.

but the talent, achievement and questlog MicroButtons seem to want to stick together... any ideas why?

Thanks in advance... rabbit

Last edited by Rabbit007 : 11-21-08 at 05:20 AM.
  Reply With Quote
11-21-08, 07:48 AM   #2
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
you sure you have setup "Kranix" correctly ? because if you use SetParent(Kranix) , Kranix must be defined else anything attached to it will be buggy, else try changing the "CENTER" to "LEFT"
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)

Last edited by Mera : 11-21-08 at 07:52 AM.
  Reply With Quote
11-21-08, 01:17 PM   #3
Rabbit007
A Black Drake
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 81
Yeah, Kranix is the same size as the Screen from corner to corner... it does that when i paretn the anchors to SetParentUIParent) as well.
  Reply With Quote
11-21-08, 02:53 PM   #4
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
This is a guess but I think some Blizzard code is SetPointing it back together.

Try using
Code:
local function returnend () return end
frame.SetPoint = returnend
This should overwrite the existing function, meaning that nothing will be able to move the frame.

Hope this helps.
  Reply With Quote
11-22-08, 09:31 AM   #5
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
strange I tested your code under wowlua without defining Kranix and it worked fine I dont have the bug you show on the pic, maybe look to check if you do not have another addon conflicting with your code, nor you have maybe badly setup Kranix, try to undefine it.
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)
  Reply With Quote
11-22-08, 05:06 PM   #6
Rabbit007
A Black Drake
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 81
Alrighty... i will try it again except i will set the frames to the UIParent instead of setting it to Kranix like you said and will post results.
  Reply With Quote
11-22-08, 11:45 PM   #7
Rabbit007
A Black Drake
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 81
Nope.. still doing it.. i even deleted WTF, Interface, cache and bal bla folders and did a clean update... with no add-ons redid the code in there again without any frames just using the script with everything parented to the UIParent and it is still sticking the same buttons together

and I don't think it's the anchors casue the ClearAllPoints() should take care of that. So what in the world would be causing the button's to sticky together? is there soemthing in blizzards code that is rewriting the point? oohhh what about clamping... could that be it? gonna test clamping it to the screen and see what happens

Last edited by Rabbit007 : 11-22-08 at 11:51 PM.
  Reply With Quote
11-23-08, 04:39 AM   #8
Rabbit007
A Black Drake
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 81
Alrighty all thanks for the help ... I figured out what the issue was.... for some reason when i was anchoring to the UIParent it was doing that but not when i created a seperate frame from through the XML for it .

and also the way i was anchoring it... is working fine now .

Thanks again for all those great suggestions and tips

Rabbit
  Reply With Quote
11-23-08, 06:04 AM   #9
Taffu
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 149
I would suggest (like Slakah mentioned), when moving Blizzard elements (especially on the Main Bar), using a dummy function to negate the SetPoint call on an object you're moving.

For instance, add a local dummy function:

Code:
local dummy = function() end
And then define elements :SetPoint as your dummy function:

Code:
------Micro Menu------

local dummy = function() end
MainMenuBar:Hide()

local a = CharacterMicroButton

a:ClearAllPoints()
a:SetParent(Kranix)
a:SetPoint("BOTTOM",-240,0)
a:SetPoint = dummy
a:Show()

[...]
There are Event-triggered updates that realign buttons & bars in the Blizzard source, so even if they remain still for a short period of time, eventually you will end up with a hiccup that will move things around due to some of Blizzards code realigning it's elements.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Something Wrong With My Code? Help Appreciated :)


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