Thread Tools Display Modes
09-14-16, 03:21 AM   #1
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Problems with "InterfaceOptionsFrame_OpenToCategory"

Hi,

I use the function "InterfaceOptionsFrame_OpenToCategory(myFrame)" to open my addon's config menu, but if I use this command 2 or 3 times, all my checkbox will appear checked, even if "myBox:setChecked(false)

Do you have some solutions ?

Last edited by Marsgames : 09-14-16 at 06:01 AM.
  Reply With Quote
09-14-16, 05:09 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
See: https://www.wowinterface.com/forums/...ad.php?t=43637
__________________
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
09-14-16, 05:19 AM   #3
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
So, here is how I create my frame for the menu :
Lua Code:
  1. function GHOptionPanel()
  2.     frameInterface = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
  3.     frameInterface.name = "GearHelper"
  4.     frameInterface:Hide()
  5.     frameInterface:SetScript("OnShow", function(frame)
  6.  
  7.     [...]
  8.  
  9. end

my function to create a checkBox ;
Lua Code:
  1. local function createButton( nomButton, frameParent, posX, posY, text )
  2.     local nomButton = CreateFrame("CheckButton", tostring( nomButton ), frameParent, "UICheckButtonTemplate")  
  3.     nomButton:SetPoint("CENTER", posX + decallageX, posY + decallageY)
  4.     nomButton.text:SetText(text)
  5.     nomButton:SetFrameStrata("HIGH")
  6.     --nomButton:SetScale(1.25)
  7.  
  8.     return nomButton
  9. end

implementation of a checkbox :
Lua Code:
  1. function GHOptionPanel()
  2.  
  3.     [...]
  4.    
  5.     local checkGHActivated = createButton(checkGHActivated, frameInterface, -150, 90, L["checkGHActivated"])
  6.     if GHActivated then
  7.         checkGHActivated:SetChecked(true)
  8.     else
  9.         checkGHActivated:SetChecked(false)
  10.     end
  11.  
  12.     [...]
  13.  
  14. end

and finally the slash cmd (/gh config) to open the menu :
Lua Code:
  1. config = function ( msg )
  2.         InterfaceOptionsFrame_OpenToCategory(frameInterface)
  3.         InterfaceOptionsFrame_OpenToCategory(frameInterface)
  4.         end,
  5.  
  6. -- InterfaceOptionsFrame_OpenToCategory(frameInterface) is call twice to be open on the addon page, and not just the escape --> interface panel)
  Reply With Quote
09-14-16, 05:28 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Marsgames View Post
Hi,

I use the function "InterfaceOptionsFrame_OpenToCategory(myFrame)" to open my addon's config menu, but if I use this command 2 or 3 thimes, all my checkbox will appear checked, even if "myBox:setChecked(false)

Do you have some solutions ?
Every time you use that command, you want to update every dinamic widget (editbox, slider, checkbox, colorpicker) that is used by your addon on that page. Lazy fix just create an OnShow script and update with that.
  Reply With Quote
09-14-16, 05:40 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
The correct solution is to use a "refresh" function:

Code:
<your panel here>.refresh = function()
    -- update your widget states here
end
The interface options system automatically calls this function (if it exists) whenever your panel is opened.
__________________
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
09-14-16, 06:03 AM   #6
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Thank you all, that works perfectly well now
  Reply With Quote
09-15-16, 12:28 PM   #7
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Phanx, why is Bush replacing the cat?
  Reply With Quote
09-15-16, 03:38 PM   #8
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Question

Phanx, did you see this world quest yet

http://www.wowhead.com/quest=43709/seal-clubbing
  Reply With Quote
09-16-16, 01:52 AM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Nice thread hijack, guys.

Originally Posted by Nimhfree View Post
Phanx, why is Bush replacing the cat?
The "is our children learning" quote came to mind the other day, and this came up in the Google image search and made me giggle, so I had to use it for a while. Don't worry, the cat (or a cat) will reappear at some point. To tide you over until then, here is a picture of my cat gloating after stealing my chair:



Originally Posted by Ketho View Post
Phanx, did you see this world quest yet

http://www.wowhead.com/quest=43709/seal-clubbing
Nope. I haven't had an active subscription in almost a year now, and don't have any plans to reactivate.
__________________
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 » General Authoring Discussion » Problems with "InterfaceOptionsFrame_OpenToCategory"


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