WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Navigating to a keybinding category (https://www.wowinterface.com/forums/showthread.php?t=59338)

Walkerbo 11-12-22 05:55 PM

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?

Walkerbo 11-21-22 06:04 PM

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.

Walkerbo 11-26-22 06:27 PM

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.

Walkerbo 11-27-22 10:23 PM

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.


All times are GMT -6. The time now is 04:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI