Thread Tools Display Modes
03-20-11, 06:11 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
World Targets as key binds.

Is there any way to get the world target stuff into the bindings? i can clear them with a binding via an addon but the setting of them is restricted. this code was used to make a button that runs it as a macro. anyway to get this transferred into a function that could be added to the bindings.xml?
Code:
EWM_GreenFlare:SetAttribute("macrotext", [[
/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton
/click DropDownList1Button2
]]);
and to take this a step further... would it not be possible to create a button like was done for this then somehow add it to the dropdown menu to take care of the infamous setfocus problem with user created unitframes that maintain their drop down menus?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-20-11 at 06:18 PM.
  Reply With Quote
03-20-11, 06:58 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Bindings.xml:
Code:
<Bindings>
	<Binding name="CLICK EWM_GreenFlare:LeftButton" header="FLARES">
		-- click the button
	</Binding>
</Bindings>
Add to your Lua file:
Code:
BINDING_HEADER_FLARES = "Flares"
_G["BINDING_NAME_CLICK EWM_GreenFlare:LeftButton"] = "Green Flare"
Originally Posted by Grimsin View Post
would it not be possible to create a button like was done for this then somehow add it to the dropdown menu to take care of the infamous setfocus problem with user created unitframes that maintain their drop down menus?
Maybe, but it would only work out of combat, and it would require a lot of painful hooking into Blizzard's dropdown menu system. You can't show or reposition a secure button over the dropdown while in combat, and if you just leave it attached to the dropdown, then the dropdown is protected and you can't open or reposition it while in combat either.

All in all I'd say it wouldn't be worth the effort. Binding a key to set/clear focus really isn't that hard. If you really want something you can click, make a macro that says "/focus" and put it on an action button. Hell, I type "/focus" by hand every time and still don't think it's an inordinate amount of effort.
  Reply With Quote
03-20-11, 07:02 PM   #3
Xinhuan
A Chromatic Dragonspawn
 
Xinhuan's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 174
Nope, its not possible. It's restricted as you said.
__________________
Author of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, GatherMate2, Routes and Cartographer_Routes
  Reply With Quote
03-20-11, 07:29 PM   #4
Crissa
A Flamescale Wyrmkin
 
Crissa's Avatar
Join Date: May 2008
Posts: 136
What's a world target?

-Crissa
  Reply With Quote
03-20-11, 07:55 PM   #5
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by Phanx View Post
Maybe, but it would only work out of combat, and it would require a lot of painful hooking into Blizzard's dropdown menu system. You can't show or reposition a secure button over the dropdown while in combat, and if you just leave it attached to the dropdown, then the dropdown is protected and you can't open or reposition it while in combat either.

All in all I'd say it wouldn't be worth the effort. Binding a key to set/clear focus really isn't that hard. If you really want something you can click, make a macro that says "/focus" and put it on an action button. Hell, I type "/focus" by hand every time and still don't think it's an inordinate amount of effort.
In theory if you use the same method of creating secure template buttons you should be able to use it in combat as you can use the world targets in combat and they are secure to. Would it not be possible to do the same as we just did for the bindings? and then just rebuild the dropdown menu as one would normally for adding any button to it?

like this
Code:
local GuildInviteButtonInfo = {
	text = "Guild Invite",
	value = "GUILD_INVITE",
	func = function() GuildInvite(UIDROPDOWNMENU_OPEN_MENU.name) end,
	notCheckable = 1,
}
but then make the function of course the click handler for the secure template? granted yes you would have to remove all buttons from the dropdownlist via DropDownList1.numButtons = DropDownList1.numButtons - numButtons then load each button back to the frame... i do this for repositioning the cancel button on the dropdowns after adding my invite friend or invite guild button additions. It just bugs me that the drop down menus dont work like they should lol... i use the bliz built in setfocus key binding
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-20-11, 11:51 PM   #6
Crissa
A Flamescale Wyrmkin
 
Crissa's Avatar
Join Date: May 2008
Posts: 136
They would have to had created the secure calls.

I don't even know what these are, so it's plausible the calls haven't been made.

-Crissa
  Reply With Quote
03-21-11, 09:52 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Grimsin View Post
In theory if you use the same method of creating secure template buttons you should be able to use it in combat as you can use the world targets in combat and they are secure to. Would it not be possible to do the same as we just did for the bindings? and then just rebuild the dropdown menu as one would normally for adding any button to it?
No. You cannot show or hide a secure frame while you are in combat except through the use of secure frame attributes, such as "when Secure Object A is clicked, show Secure Object B" or "when your target is hostile, show Secure Object A" or "while Shift is pressed, show Secure Object A". Dropdown menus are not secure frames, so it is not possible to write code to automatically show a secure frame when a dropdown menu is shown, or hide a secure frame when a dropdown menu is hidden.

You also cannot change the position of a secure frame while you are in combat programmatically (eg. without the user actually clicking and dragging it), so even if you found some way to show the button, you could not position it to overlay the dropdown menu entry button.

Also, since dropdown menus are not secure, you cannot call restricted/protected functions inside normal dropdown menu click handlers.

You might be able to get a working "menu" by using secure action buttons and adding textures to make them look like a dropdown menu. I'm not sure how you would show and hide it, though, as I haven't spent that much time dealing with the secure state/attribute system. It may not even be possible to show/hide secure action buttons by clicking on a secure unit button. Even if it is, you would have to create the entire "menu" from scratch, and you could not use any of Blizzard's dropdown menu code. You would also have to create a separate set of action buttons for each unit frame (since you cannot move a single set of action buttons to attach them to the specific frame clicked on) and you would not be able to dynamically change the menu contents depending on what kind of unit was currently displayed on the frame (eg. group member, hostile player, friendly mob) while in combat.

Originally Posted by Grimsin View Post
like this
Code:
local GuildInviteButtonInfo = {
	text = "Guild Invite",
	value = "GUILD_INVITE",
	func = function() GuildInvite(UIDROPDOWNMENU_OPEN_MENU.name) end,
	notCheckable = 1,
}
Again, no. A dropdown menu click handler is not secure. A keybinding is.

Even if it's possible to approximate a "dropdown menu" with working set/clear focus buttons (and I don't know that it is), it would be clunky in operation and an enormous amount of work to build, and I stand by my original assertion that it's not worth the effort.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » World Targets as key binds.


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