Quantcast
KGPanels script help - WoWInterface
Thread Tools Display Modes
04-19-12, 03:43 PM   #1
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
KGPanels script help

I'm trying to make a kgpanel hide or show with OnCLick script, but having no luck. I THINK I understand the concept, with having 2 panels, one for button, and one the named,'fetched' panel, but it doesn't seem to be working...it will show up once (default state is hidden) but when clicked to hide again, it throws an error, about a nil variable. The sample script on KGPanels page USED to work (although it was made for 3 panels, not 2) but it no longer does. I could have sworn there was a forum post that just had one script in OnCLick, that accomplished what I'm trying to.

TL/DR: Trying to find a script for kgpanels that will hide/show panel based OnClick, with only 2 panels...a button panel, and the panel it fetches.
__________________

Last edited by Kendian : 04-19-12 at 04:55 PM.
  Reply With Quote
04-19-12, 07:15 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,766
I see no such script on the Sample Scripts page at wowace. Since I don't know what script you're using, and I don't know exactly what error you're getting, I can't really help you fix your script.

But I can give you a new one.

In the OnLoad section of the panel you wish to hide/show put this:
Lua Code:
  1. self:Hide()

In the panel you wish to use as a button, put this in OnLoad:
Lua Code:
  1. self.shown = false

and this in OnClick:
Lua Code:
  1. --replace toggledFrame with whatever you named that panel!
  2. self.toggledFrame = kgPanels:FetchFrame("toggledFrame")
  3.  
  4. if pressed then
  5.      if self.shown then
  6.           self.toggledFrame:Hide()
  7.      else
  8.           self.toggledFrame:Show()
  9.      end
  10.      self.shown = not self.shown
  11. end
__________________
"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


Last edited by Seerah : 04-19-12 at 08:15 PM.
  Reply With Quote
04-19-12, 07:53 PM   #3
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
This is almost exactly what I was looking for, lady, my thanks. Only issue, it does not hide again, upon second click, only after I /reload. Am I doing something wrong? Thanks again, for the help~
__________________
  Reply With Quote
04-19-12, 08:15 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,766
Oops, I knew that I'd make a stupid mistake. I've updated the previous post.
__________________
"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
04-19-12, 08:21 PM   #5
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Perfect! My heartfelt thanks, lady~
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KGPanels script help

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