Quantcast
Navigating to a keybinding category - WoWInterface
Thread Tools Display Modes
11-12-22, 05:55 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 206
Navigating to a keybinding category

Hi all

After the changes brought about by 10 the keybindings menu is now available in the game options.
I had a button that opened my keybinding list.
Previously I used;
Lua Code:
  1. SwarmKeybindingButton:SetScript(
  2.     "OnClick",
  3.     function()
  4.         GameMenuButtonKeybindings:Click("RightButton")
  5.         InterfaceOptionsFrame:Hide()
  6.         KeyBindingFrame:Show()
  7.         for _, v in pairs(KeyBindingFrame.categoryList.buttons) do
  8.             if v:GetText() == "Walkerbo's Addons" or v:GetText() == "WALKERBO'S ADDONS" then
  9.                 v:Click()
  10.             end
  11.         end
  12.     end
  13. )

I know that the keybindings header tags are not working yet, so I won't be able to jump directly to an individual keybindings header; but how do I now open directly to my category of keybinds?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
11-21-22, 06:04 PM   #2
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 206
Okay after a bit more investigating I have this:

Lua Code:
  1. GameMenuButtonSettings;Click("RightButton")  -- open game menu
  2. SettingsPanel.GameTab:Click("RightButton") -- click the game tab
Then from there, I have to loop through the category list:
Lua Code:
  1. for k, v in pairs(SettingsPanel.CategoryList) do  
  2.    print(k, v)  
  3. end
The keybindings button is the 7th element;
Lua Code:
  1. for k, v in pairs(SettingsPanel.CategoryList.elementList) do
  2.    for a, b in pairs(v) do
  3.       if k == 7 then        
  4.          print(k, a, b)    
  5.          if a == "data" then
  6.             print("FOUND", k, a, b)            
  7.          end
  8.       end
  9.    end
  10. end
The problem is that getting to the 7th element is wrong as I have to manually count the elements rather than reading each element.
Then from there, I need to identify the current element as a button then read that button text and from there I need to click the keybinding button.

Now that I am a bit closer to my goal I have hit a wall and am floundering once again.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
11-26-22, 06:27 PM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 206
A little bit more progress.
I can now identify button elements;
Lua Code:
  1. for k, v in pairs(SettingsPanel.CategoryList.elementList) do
  2.     for a, b in pairs(v) do
  3.         if b == "SettingsCategoryListButtonTemplate" then
  4.             print(k, a, "This is a button")
  5.         end
  6.     end
  7. end

Still working on determining which button is the keybindings button.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
11-27-22, 10:23 PM   #4
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 206
A little closer to an answer;
Lua Code:
  1. for k, v in pairs(SettingsPanel.CategoryList.elementList) do
  2.    for a, b in pairs(v) do      
  3.       if k == 7 then            
  4.          if a == "data" then          
  5.             for q, w in pairs(b) do
  6.                if q == "category" then
  7.                   if w:GetName() == "Keybindings" then
  8.                      print("keybindins button found")  
  9.                   end
  10.                end
  11.             end        
  12.          end
  13.       end
  14.    end
  15. end

I would believe that
Lua Code:
  1. w:Click("RightButton")
would work but it no longer does as w is a table.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz

Last edited by Walkerbo : 11-27-22 at 10:28 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Navigating to a keybinding category

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