View Single Post
07-22-20, 07:32 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Getting item details on hover

Hi all

I am looking for some help in regards to getting an itemID when I click an item in the adventure guide, my bags and my bank.

I have worked out how to get the itemID of items in my bags and bank but it requires that I have to pick up the item first.

Lua Code:
  1. local btn = CreateFrame("BUTTON", "myTest")
  2. SetBindingClick("ALT-CTRL-BUTTON1", "myTest","b1")
  3. SetBindingClick("BUTTON2", "myTest","b2")
  4. SetBindingClick("ALT-SHIFT-T", "myTest","st")
  5. btn:SetScript("OnClick", function(self, button)
  6.       if button == "b1" then
  7.          local cursorItemType, cursorItemID = GetCursorInfo()
  8.          print("mouse button 1 clicked",cursorItemType,cursorItemLink)
  9.       elseif button == "b2" then
  10.          print( "The mouse is over " .. GetMouseFocus():GetName() );
  11.          local cursorItemType, cursorItemID = GetCursorInfo()
  12.          print("mouse button 2 clicked",cursorItemType,cursorItemLink)
  13.       elseif button == "st" then
  14.          local cursorItemType, cursorItemID, cursorItemLink = GetCursorInfo()
  15.          print("Shift-T buttons clicked",cursorItemType,cursorItemLink)
  16.       end
  17. end)

Is there a way to get an itemID on a down press or under the cursor rather than having to pick up the item first? and/or is there a call such as GetItemDetailsUnderCursor()?

Also, I have had little luck finding a good tutorial on how to add keybindings to the binding UI so any help with pointing me to such an example/tutorial would be great.

Cheers

Last edited by Walkerbo : 07-22-20 at 09:55 PM.
  Reply With Quote