Thread Tools Display Modes
08-18-10, 03:35 AM   #1
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
[kgPanels]: Showing/Hiding another panel

Hey, guys, I need some help, with kgPanels.
What do I want to do, is:
Making two panels with kgPanels. The first is the Hide, the second is the Show button, like in FaulTier's Shining UI.
The first hides a kgPanel, and two BT4 action bars, and the second hides them.

FaulTier gave me some scripts. The Hide button's script is fully working - but the show is messed up. I've downloaded his UI and it worked, but on my UI it just simply doesn't work. Whenever I click the Show button, it lags the game for about 0.5 seconds, and that's all.

My scriptiez are below. (A PM directly quoted from FaulTier).


Originally Posted by FaulTier
i'll show you directly the scripts of my bar-buttons:

First Button, to HIDE the bar, named "barSideHide":
OnLoad:
Code:
self:Show()
OnClick:
Code:
local button = kgPanels:FetchFrame("barSideShow")
local bar = kgPanels:FetchFrame("BarSide")

bar:Hide()
BT4Bar5:Hide()
BT4Bar6:Hide()
self:Hide()
button:Show()

Second button, to show the bar, named "barSideShow":
OnLoad
Code:
self:Hide()

OnClick:
Code:
local button = kgPanels:FetchFrame("BarSideHide")
local bar3 = kgPanels:FetchFrame("BarSide")

button:Show()
bar3:Show()
BT4Bar5:Show()
BT4Bar6:Show()
self:Hide()


The Third is just the Panel you would like to manage. In this case it's "BarSide", which is the background for the Bars in the right of my interface. BT4Bar 5 and 6 are the bars.
You need to make the first and second panel being clickable and at best you take same size and position but different textures/colours for them.

Hope it's well enough described.
greetz

Please, help! I really need it for my UI. Thanks.
  Reply With Quote
08-18-10, 06:20 AM   #2
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Bumpity bumpity bump bump bump. Seriously need help. >.<
  Reply With Quote
08-18-10, 10:40 AM   #3
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
You can do this with one panel if you have a toggle function
Code:
local b1, b2, b3 = BT4Bar5, BT4Bar6, kgPanels:FetchFrame("extraBarBG")

if b1:IsShown() or b2:IsShown() or b3:IsShown() then
  b1:Hide()
  b2:Hide()
  b3:Hide()
  self.text:SetText('Show Bars')
else
  b1:Show()
  b2:Show()
  b3:Show()
  self.text:SetText('Hide Bars')
end
You can offcourse also use a different way of modifying the button, like changing the texture or the border colour.
  Reply With Quote
08-18-10, 01:19 PM   #4
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Originally Posted by mrruben5 View Post
You can do this with one panel if you have a toggle function
Code:
local b1, b2, b3 = BT4Bar5, BT4Bar6, kgPanels:FetchFrame("extraBarBG")

if b1:IsShown() or b2:IsShown() or b3:IsShown() then
  b1:Hide()
  b2:Hide()
  b3:Hide()
  self.text:SetText('Show Bars')
else
  b1:Show()
  b2:Show()
  b3:Show()
  self.text:SetText('Hide Bars')
end
You can offcourse also use a different way of modifying the button, like changing the texture or the border colour.
Thanks, I'll make a try.
  Reply With Quote
08-18-10, 01:32 PM   #5
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Epic, dude, it's working! But there is a problem. Whenever I release my mouse button, it shows again the panels. I need this to hide the panel until I press the hiding/showing toggle panel again.
Solution anybody?
  Reply With Quote
08-19-10, 03:27 AM   #6
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Anyone could help, please?
  Reply With Quote
08-19-10, 06:33 AM   #7
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Sorry for flooding this topic, or bumping like hell, but I need this, seriously... and quickly. I am making a UI, and this is important for it.
Thanks.
  Reply With Quote
08-19-10, 10:24 AM   #8
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
I honestly cannot follow what you're trying to do but for any kgPanels scripts I make to hide things by OnClick I use

OnClick:
Code:
if pressed then

kgPanels:FetchFrame("EpicFrameTitlez"):Hide()
kgPnaels:FetchFrame("LessEpicFrameTitlez"):Show()

end
  Reply With Quote
08-19-10, 10:41 AM   #9
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
I try to explain it, as good as I can.

Code:
local b1, b2, b3 = BT4Bar5, BT4Bar6, kgPanels:FetchFrame("extraBarBG")

if b1:IsShown() or b2:IsShown() or b3:IsShown() then
  b1:Hide()
  b2:Hide()
  b3:Hide()
  self.text:SetText('Show Bars')
else
  b1:Show()
  b2:Show()
  b3:Show()
  self.text:SetText('Hide Bars')
end
I have this onClick script. When I click on it, it hides the bars that I want to hide. Yea, cool. But when I release my mouse button, the bars appear again.
That's not cool.
I want to make it like this:
Click - hide. Click again - show.

I hope it's understandable... my English is not perfect.
  Reply With Quote
08-19-10, 01:16 PM   #10
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
I believe in kgPanels "OnClick" area, it fires on both OnPressed and OnReleased. You have to, in your script, make it react to only one of those two - otherwise it's called when you press down on the mouse button, and then called again when you let go of the mouse button.

A little looks-y at the kgPanels page on wowace says
Code:
OnClick now provides a pressed and released variable you can check for.
if pressed then
  -- do mouse down actions
elsif released then
  -- do mouse up actions
end

This means your script will get called twice when someone clicks the panel.
So just enclose the important code within an if-then statement, like so:
Code:
local b1, b2, b3 = BT4Bar5, BT4Bar6, kgPanels:FetchFrame("extraBarBG")

if pressed then 
  if b1:IsShown() or b2:IsShown() or b3:IsShown() then
    b1:Hide()
    b2:Hide()
    b3:Hide()
    self.text:SetText('Show Bars')
  else
    b1:Show()
    b2:Show()
    b3:Show()
    self.text:SetText('Hide Bars')
  end
end
That should fix it so that it works as a toggle.
__________________
-- Taryble
  Reply With Quote
08-19-10, 01:31 PM   #11
DarkVanir
A Deviate Faerie Dragon
 
DarkVanir's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 18
Thanks, dude, I'll make a try. God, I have to learn Lua.

Edit: it's working! Thanks dude!

Last edited by DarkVanir : 08-19-10 at 01:43 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » [kgPanels]: Showing/Hiding another panel


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