kgPanels

Create panels for customizing your UI, sucessor to eePanels

Wiki and FAQ

Sample Scripts

OnClick now provides a pressed and released variable you can check for.

if pressed then
  -- do mouse down actions
elseif released then
  -- do mouse up actions
end

This means your script will get called twice when someone clicks the panel.

Here is a youtube link to a video Tutorial

Ive created an Example Texture Pack.

This example pack is just a template. If you want to use it as a storage spot for your art, look at the read me file for directions on usage.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of arturogatti arturogatti Nov 05, 2009 at 14:06 UTC - 0 likes

    Damn... this is starting to get a bit too much for me...

    I tried the <OnEvent> code but it didnt work... cause it gets "stuck" on the arg1 "parts".

    Can you explain better what you mean with that arg1 parameter is?

    ...and what you mean by these:

    Try to print arg1 if it exists Should work if UNIT_ENTERED_VEHICLE and UNIT_EXITED_VEHICLE events have an arg1 parameter that is a unit id.

    The best is to example me what to put on the arg1 part of the code.

    My english isn't the best... it blows my mind when i try to understand some parts of what you're saying.

    Thanks again ;)

  • Avatar of ImpalerCore ImpalerCore Nov 02, 2009 at 17:56 UTC - 0 likes

    Hmmm,

    With respect to the party vehicle problem, I can surmise that you are getting events for party members in addition to yourself. Unfortunately, the documentation for the event is not clear. I can guess that it has an arg1 parameter that is the unit id, but I can't verify it. The documentation for it on wow programming site doesn't document it.

    http://wowprogramming.com/docs/events/UNIT_ENTERED_VEHICLE

    However, many of the other UNIT_* events have the first parameter as the unit id, so assuming that arg1 is the unit should be a reasonable assumption.

    <OnLoad>
    self:RegisterEvent ("UNIT_ENTERED_VEHICLE")
    self:RegisterEvent ("UNIT_EXITED_VEHICLE")
    
    <OnEvent>
    -- Try to print arg1 if it exists
    DEFAULT_CHAT_FRAME:AddMessage( arg1 )
    
    -- Should work if UNIT_ENTERED_VEHICLE and UNIT_EXITED_VEHICLE events
    -- have an arg1 parameter that is a unit id.
    if arg1 ~= 'player' then
        return
    end
    
    if event == "UNIT_ENTERED_VEHICLE" then
        self:Hide()
    elseif event == "UNIT_EXITED_VEHICLE" then
        self:Show()
    end
    

    For the second question, I forgot to add a ClearAllPoints call. This resets all the anchor points. The SetPoint is all relative to the current anchor points, so changing anchors with SetPoint usually requires a previous ClearAllPoints.

    http://www.wowwiki.com/API_Region_ClearAllPoints

    <OnLoad>
    self:RegisterEvent ("UNIT_ENTERED_VEHICLE")
    self:RegisterEvent ("UNIT_EXITED_VEHICLE")
    
    <OnEvent>
    if event == "UNIT_ENTERED_VEHICLE" then
        Minimap:ClearAllPoints()
        Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 0, 0 )
    elseif event == "UNIT_EXITED_VEHICLE" then
        Minimap:ClearAllPoints()
        Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 100, 100 )
    end
    

    As far as moving the actual minimap frame instead of a decoration depends on whether you can find it with the frame finder. Some addons manipulate the actual Minimap from WoW, and from looking at the BasciMinimap code, that is what it does. So using Minimap is the proper frame. There is also a border frame that is used as well from this CreateFrame call.

    local border = CreateFrame("Frame", "BasicMinimapBorder", Minimap)

    The name of the border is "BasicMinimapBorder", and uses the Minimap frame as its parent. There is also a MinimapCluster frame that I think collects all the minimap children frames. This means that you still use the Minimap (or maybe MinimapCluster) frame to alter its coordinates. In other minimap mods, they create an entirely new minimap frame and hide the original like Minimap:Hide().

    To render the code fragments, it consists of either highlighting a section of text and clicking the gear icon on the toolbar's far right, using lua as the default argument, or you can use '<<' and '>>' brackets with 'code lua' and '/code' (which is what the gear icon does for you).

    Looking forward to hear if this works for ya.

    Last edited Nov 02, 2009 by ImpalerCore
  • Avatar of arturogatti arturogatti Nov 02, 2009 at 14:06 UTC - 0 likes

    First, the following code does hide the frames when i enter any vehicle...

    <OnLoad> self:RegisterEvent ("UNIT_ENTERED_VEHICLE") self:RegisterEvent ("UNIT_EXITED_VEHICLE")

    <OnEvent> if event == "UNIT_ENTERED_VEHICLE" then self:Hide() elseif event == "UNIT_EXITED_VEHICLE" then self:Show() end

    But now I have another weird problem...

    Its also hides my frames when someone from my party enters a vehicle. What can be really annoying.

    Now about the minimap question... I parented/anchored a decorative frame i have to the Minimap and i tried to set the following code on it:

    <OnLoad> self:RegisterEvent ("UNIT_ENTERED_VEHICLE") self:RegisterEvent ("UNIT_EXITED_VEHICLE")

    <OnEvent> if event == "UNIT_ENTERED_VEHICLE" then Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 0, 0 ) elseif event == "UNIT_EXITED_VEHICLE" then Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 100, 100 ) end

    ...and it does move my minimap when i enter a vehicle. I also tried changing the coordenates of the code but it doesnt return to the starting coordenates when i exit a vehicle.

    I use an addon named BasicMinimap. Is there a way to use that code on the Minimap itself instead of on my decorative frame around it?

    Once again,

    Thank you very much ;)

    PS: sorry the way the code turned out in the post... dunno how to make it look like on your posts.

    Last edited Nov 02, 2009 by arturogatti
  • Avatar of ImpalerCore ImpalerCore Oct 27, 2009 at 15:42 UTC - 0 likes

    I've not done any vehicle based stuff, but I can make a guess.

    <OnLoad>
    self:RegisterEvent ("UNIT_ENTERED_VEHICLE")
    self:RegisterEvent ("UNIT_EXITED_VEHICLE")
    
    <OnEvent>
    if event == "UNIT_ENTERED_VEHICLE" then
        self:Hide()
    elseif event == "UNIT_EXITED_VEHICLE" then
        self:Show()
    end
    

    To hide all the unitframes, you would need to invoke Hide() on all the respective global references to those frames. For Pitbull3, this can be something akin to

    PitBullUnitFrame1:Hide()
    PitBullUnitFrame2:Hide()
    ...
    PitBullUnitFrame7:Hide()
    

    Use the frame finder to create a list of unit frames you want to hide and add them to the OnEvent of your kgpanel. If you have kgpanel decorations to those frames, they should hide as well if they are parented properly.

    For changing the minimap location, you need to again find its frame name, and you can move it using the SetPoint command.

    http://www.wowwiki.com/API_Region_SetPoint

    You can use UIParent as the relative frame and "CENTER" as the relative point to center it on screen, and use ofsx and ofsy to position it. You should be able to anchor it to any corner using some combination of "TOP", "LEFT", "BOTTOM", and "RIGHT".

    If you're using the regular blizzard minimap frame, I think its name is just Minimap, so you could do something like this.

    <OnLoad>
    self:RegisterEvent ("UNIT_ENTERED_VEHICLE")
    self:RegisterEvent ("UNIT_EXITED_VEHICLE")
    
    <OnEvent>
    if event == "UNIT_ENTERED_VEHICLE" then
        Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 0, 0 )
    elseif event == "UNIT_EXITED_VEHICLE" then
        Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 100, 100 )
    end
    

    If you use a minimap addon, you'll have to use a different name. Again use the frame finder.

    As far as individual vehicle frame names, I do not know. There is a UnitInVehicle API function to determine whether a unit is in a vehicle, like UnitInVehicle( 'player' ), but nothing specific to vehicle name that I could find after a 5 min google search. Getting the vehicle name could be implemented in an addon somewhere, but I currently don't know how to do it.

    http://wowprogramming.com/utils/xmlbrowser is a good resource to look up how to do things as well if you get stuck and you have time to browse for vehicle name. If you get something working, it would be nice to post back to further the kgpanel script kiddies.

    Good luck!

  • Avatar of arturogatti arturogatti Oct 27, 2009 at 05:23 UTC - 0 likes

    Is there a way to see the vehicles frame name?

    Do they all have the same frame name? or is there a specific name for each one of them? (i mean.. the diferent type of vehicles... wintergrasp cannons, argent tournament lance mounts, etc...)

    Anyway... How do I make all my UI Frames Hide when i enter a vehicle?

    and...

    Is there a script for changing my minimap place (x,y) in the screen when i enter a vehicle?

    Thanks in advance ;)

  • Avatar of arturogatti arturogatti Oct 26, 2009 at 15:32 UTC - 0 likes

    Finished trying it... works 100% :D

    It wasnt the case sensitive problem... I accidently had a <space> in the end of the Pitbull4_Frames_targettarget XD

    Anyway... once again..

    Ty very much! ;)

  • Avatar of ImpalerCore ImpalerCore Oct 26, 2009 at 14:01 UTC - 0 likes

    Are you still having issues arturo? You have to be careful that the case of the letters in the name is exact.

  • Avatar of zernon916 zernon916 Oct 24, 2009 at 18:40 UTC - 0 likes

    For Pitbull4 I used: Anchor = Pitbull4_Frames_targettarget Parent = Pitbull4_Frames_targettarget

    Dont capitalize Targettarget. It is cap sensitive. targettarget is the correct way :)

  • Avatar of arturogatti arturogatti Oct 24, 2009 at 03:12 UTC - 0 likes

    hmm... i think im doing it all correctly but the frame doesnt load when the Pitbull4_Frames_Targettarget shows. (yes, im using pitbull4)

    i think im parenting it well...

    im setting "PitBull4_Frames_targettarget" on both Parent Frame and Anchor Frame. They're both set to Center.

    so... am i missing somethin? :x

    thanks once again ;)

  • Avatar of ImpalerCore ImpalerCore Oct 23, 2009 at 21:14 UTC - 0 likes

    If these panels are decorations, then it should be as simple as using the frame finder to find the name of the Pitbull Frame, and then just set the parent of your kgpanel to that frame.

    I.E. for Pitbull3, the TargetOfTarget frame should be PitBullUnitFrame3, so that would be the name you would enter as the parent of your kgpanel.

    Use the frame finder on the pet frame and parent it to that and you should be set.

Facts

Date created
Sep 16, 2008
Category
Last update
Sep 10, 2013
Development stage
Release
Language
  • enUS
  • frFR
  • koKR
  • zhCN
License
All Rights Reserved
Curse link
kgPanels
Reverse relationships
1
Downloads
1,718,315
Recent files
  • R: 1.17 for 5.4.0 Sep 10, 2013
  • A: r428 for 5.4.0 Sep 10, 2013
  • R: 1.16 for 5.3.0 May 22, 2013
  • A: r426 for 5.3.0 May 22, 2013
  • A: r425 for 5.2.0 Apr 29, 2013

Authors