1. For one of my addon's functions, I want the user to be able to click on a button (on my main frame) that will do the following:

    1. Change the cursor into a glowy hand
    2. Let them left-click and item in the master loot window
    3. Post a custom message + the item's link in the Raid / Raid Warning message system

    This seems like a very simple thing to do, however, I seem to be stuck even trying to find the events and functions I need. I guess the problem might be that I'm not sure if I'm looking at it the right way. Would this work?:

    1. My button's OnClick() script will change the cursor to the hand and make my button stay depressed.
    2. Somehow watch that the user hasn't hit Esc and if they have, stop the whole process (change the cursor back to an arrow and pop my button back up).
    3. Listen for a mouse click (not sure how my addon can listen to a click from another frame...but I have an idea below).
    4. Check that master loot window for which item got clicked on.
    5. Grab the link to the item and post it.
    6. Go back to normal (again, cursor goes back to arrow and my button pops up).

    I'm thinking that I may have to hook a script from the master loot window (one of the OnClick()s) to perform #3. Then #4, #5, #6 would be part of my hooked script.

    Am I even close here?

    Thanks.

    ... or maybe I'm better off letting them select an item in the loot window, and then when my button is pushed, query the loot window for the selected item:

    LootFrame.selectedItemName

    (Though I still have to get the link, not just the item name.)

    Again, thoughts?

    If I were you I'd not mess with the actual loot window at all. There's too much that can possibly go wrong, making it so you character has to disable the window in order to loot. You can do everything you want without ever messing with the loot window.

    You can use the GetLootSlotInfo and GetLootSlotLink functions to get the information you need, and then display it in your own frame. Is there a reason this isn't sufficient?

    Talk about a complicated piece of code! That loot window is something else. That said, I did get everything I want to work working, provided I stick to the first loot item, "LootButton1" (for now). Here's what I did:

    1. My player clicks the "Roll On Link" button in my addon.

    2. Change my button to looked "depressed" and change the button text to "Click Loot Item!"

    3. Hook the OnClick widget function for LootButton1 to do the following:

    a. When the lootslot is clicked, get the information (primarily the item link) for the item they clicked (in this case, slot 1)

    b. Post a message to Party or Raid Warning (depending on other settings in my addon) that says "Roll On This: "..the-item-link

    c. Unhook the OnClick widget function for LootButton1 so their next click on the item will work correctly to loot the item/give them back master looter capability

    Now, if they re-click my "Roll On Link" button it will unhook the function again, like in 3.c. above.

    There are some checks in there to see if the item they clicked is money, and if so, it just loots the item instead.

    I suppose I could have had 4 buttons, one per loot slot, that were basically "Roll On Item 1", "Roll On Item 2", etc. and each press would post the link info for that particular item, but that would make for a pretty messy interface.

    The method I chose seems to work pretty well so far...though I have to test it with master looter enabled for a few more test criteria.

    I suppose another, cleaner method might be to strap a second window onto the loot window that has "Roll On This" buttons next to each of the loot buttons. This might be a far cleaner method as well--no hooking. (Or...maybe an extra button on each loot item line in the loot window...small button...only enabled when the addon is up......hmmmmm....)

    The big problem I see with hooking the LootButton functions is that they are all numbered, one for each of the 4 buttons. And the code in the Loot Window Lua that does this is, in my opinion, quite tricky. Although I have my function working for LootButton1, I'm not entirely sure how I would use repeatable code for each of the other buttons (and may have to resort to straight out code copies for each of the hooks).

    Thanks again Jim. (I think I'm going to investigate the strap-on-window concept and keep everything simple, using just the functions that query the loot window directly as you suggested.) I definitely appreciate your opinion.

    Talk about a complicated piece of code! That loot window is something else. That said, I did get everything I want to work working, provided I stick to the first loot item, "LootButton1" (for now). Here's what I did:

    1. My player clicks the "Roll On Link" button in my addon.

    2. Change my button to looked "depressed" and change the button text to "Click Loot Item!"

    3. Hook the OnClick widget function for LootButton1 to do the following:

    This is where things get sticky. I'd recommend against this, but I've already said that.

    a. When the lootslot is clicked, get the information (primarily the item link) for the item they clicked (in this case, slot 1)

    b. Post a message to Party or Raid Warning (depending on other settings in my addon) that says "Roll On This: "..the-item-link

    c. Unhook the OnClick widget function for LootButton1 so their next click on the item will work correctly to loot the item/give them back master looter capability

    Again. Taint sucks.

    Now, if they re-click my "Roll On Link" button it will unhook the function again, like in 3.c. above.

    There are some checks in there to see if the item they clicked is money, and if so, it just loots the item instead.

    I suppose I could have had 4 buttons, one per loot slot, that were basically "Roll On Item 1", "Roll On Item 2", etc. and each press would post the link info for that particular item, but that would make for a pretty messy interface.

    The method I chose seems to work pretty well so far...though I have to test it with master looter enabled for a few more test criteria.

    I suppose another, cleaner method might be to strap a second window onto the loot window that has "Roll On This" buttons next to each of the loot buttons. This might be a far cleaner method as well--no hooking. (Or...maybe an extra button on each loot item line in the loot window...small button...only enabled when the addon is up......hmmmmm....)

    Just have a simple overlay button, 6x6 pixels, or 10x10 or something like that in the bottom right-hand-corner of the window. Then you don't need any button to 'start' the system, and you don't have to do any altering whatsoever of the default loot frame. You just layer your buttons on top.

    The big problem I see with hooking the LootButton functions is that they are all numbered, one for each of the 4 buttons. And the code in the Loot Window Lua that does this is, in my opinion, quite tricky. Although I have my function working for LootButton1, I'm not entirely sure how I would use repeatable code for each of the other buttons (and may have to resort to straight out code copies for each of the hooks).

    Thanks again Jim. (I think I'm going to investigate the strap-on-window concept and keep everything simple, using just the functions that query the loot window directly as you suggested.) I definitely appreciate your opinion.

    It shouldn't be hard to programatically figure out how many loot items there are and then generate the right amount of overlay buttons (if they don't exist). In my opinion, this is the cleanest way to do things.

    So what I ended up doing was adding overlay buttons to the loot window as you suggested (actually sticking out the side of the loot window + a little graphical tray extending the loot window so the buttons aren't floating out in space).

    I checked to see which slots had gear in them (as opposed to empty or holding money) and only showed the buttons on those slots. When an item is looted the button disappears. The buttons are only enabled for Master Looters.

    Works great.

    Thanks!

    Awesome. If you end up releasing it, let us know and post a link so others might find it!

    Already released (in beta format).

    It's called CheckMate and it's available here, on curse.com: http://wow.curse.com/downloads/wow-addons/details/checkmate.aspx There are some images posted there as well.

    I have a lot of plans for it but it's quite operable at this point. Some of the code is a bit messy and there are some commented out sections in the beta, but I've already got a bunch more work done on it (unreleased). I've also parented the whole thing to UIParent (which isn't yet done in the released beta copy) as somehow I missed that originally.

    The curse.com page lists some of the things I want to do with it down the road, including building client/server messaging into it so that it can replace the default Ready Check with a nicer version (with custom messages, etc.) for any of the players who also have it installed.

    Feel free to comment on any parts of the code that don't look right to you!

    Sounds great, thanks for the link!

    Definitely looks snazzy!