Thread Tools Display Modes
07/04/20, 10:57 PM   #1
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
Question needing to select a recipe in keyboard provisioning recipe list

I'm needing to select a specific recipe in the keyboard's provisioning recipe list.
I've managed to do it for gamepad mode with,
Code:
GAMEPAD_PROVISIONER.recipeList:SetSelectedIndex(recipeData.listIndex)
The intent is to select the entry so correct recipe information is displayed, including ingredients, for the provisioning crafting of my writ helper.
Any help would be appreciated.

Last edited by IsJustaGhost : 07/05/20 at 02:21 AM.
  Reply With Quote
07/05/20, 06:59 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Normally the variables are equal and just have a KEYBOARD (or no prefix at all) or GAMEPAD as prefix. Try just PROVISIONER or check the esoui code at github (link is at the wiki e.g.) at esoui/ingame/provisioner or similar.
The variable is either defined in the xml file or at the bottom of some lua file in the keyboard files, like PROVISIONER = Zo_Provisioner:New(...)

https://github.com/esoui/esoui/blob/...rovisioner.lua
Line 629

Last edited by Baertram : 07/05/20 at 07:08 AM.
  Reply With Quote
07/06/20, 03:27 AM   #3
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
I ended up going a different route for the reasons of,
- could not figure out how to make it change to the Drinks tab for gamepad mode.
- could not figure out how to manipulate the tree nodes to have it select the recipe in keyboard mode.

It now sets the results tooltip and ingredients directly.
  Reply With Quote
07/06/20, 04:14 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Changing the tab buttons is done via applying the "descriptor" (structure containing all relevant data of the tab button) to the ZO_MenuBar tab.
There exists a function which does this and then changes the tab for you, let me search it.

https://github.com/esoui/esoui/blob/...zo_menubar.lua

Get descriptor for a tab button:
ZO_MenuBar_GetSelectedDescriptor(buttonControl)

Set descriptor to change to a tab button:
ZO_MenuBar_SelectDescriptor(self, descriptor, skipAnimation, reselectIfSelected)


Here it is used in the provisioner part:
https://github.com/esoui/esoui/blob/...ioner.lua#L160

So it should be something like this:
Lua Code:
  1. ZO_MenuBar_SelectDescriptor(PROVISIONER.tabs, PROVISIONER.tabs[1].descriptor)
Where tabs[1] will be the first button and tabs[2] the second.
If you know the exact descriptor name you can even use this instead.

They are defined here in the provsioner crafting:
https://github.com/esoui/esoui/blob/...ioner.lua#L123

So it's a filtertype for the buttons.
And these are defined at this line and below:
https://github.com/esoui/esoui/blob/...ioner.lua#L133

So it's one of these:
Code:
PROVISIONER_SPECIAL_INGREDIENT_TYPE_SPICES
PROVISIONER_SPECIAL_INGREDIENT_TYPE_FLAVORING
PROVISIONER_SPECIAL_INGREDIENT_TYPE_FURNISHING
So just use these as the "descriptor" directly e.g.
Lua Code:
  1. ZO_MenuBar_SelectDescriptor(PROVISIONER.tabs, PROVISIONER_SPECIAL_INGREDIENT_TYPE_FURNISHING)

Last edited by Baertram : 07/06/20 at 04:22 AM.
  Reply With Quote
07/07/20, 07:30 AM   #5
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
Thank you for this info, I will look into it
  Reply With Quote
08/24/21, 07:48 AM   #6
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
I ended up figuring this out.

Lua Code:
  1. local function GetNodeByData(recipeData)
  2.     for _, listNode in pairs(PROVISIONER.recipeTree.rootNode.children) do
  3.         if listNode.data.recipeListIndex == recipeData.recipeListIndex then
  4.             for _, node in pairs(listNode.children) do
  5.                 if node.data.recipeIndex == recipeData.recipeIndex then
  6.                     return node
  7.                 end
  8.             end
  9.         end
  10.     end
  11. end
  12.  
  13. local node = GetNodeByData({recipeListIndex = 1, recipeIndex = 5})
  14. node:GetTree():SelectNode(node)
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » needing to select a recipe in keyboard provisioning recipe list

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