Thread Tools Display Modes
05-30-06, 01:22 PM   #1
Cilraaz
An Aku'mai Servant
 
Cilraaz's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 36
UIDropDownMenu Issue (menu issue fixed...now it's an editbox issue)

I'm working on my first mod (a port of TitanEmoteMenu for FuBar). I'm having a bit of trouble when putting my menus together though (almost certainly a rookie mistake). I have the following code:

Code:
function EmoteFu:MenuSettings()
	local level = 1;
	
	for key, value in EL_Types do
		local info = {};
		local val = {};
		val.isemotemenu = true;
		val.key = key;
		info.text = value;
		info.value = val;
		info.hasArrow = 1;
		UIDropDownMenu_AddButton(info, level);
	end
end
I can verify that the information is being pulled out of EL_Types by setting up a dewdrop:AddLine in the for loop. The issue seems to be when the array is being put together. Once it gets to the UIDropDownMenu_AddButton line, it appears that the array is either blank or otherwise unusable. The mod will attach to the panel, but when right clicked, will come up with nothing other than the standard menu (left, center, right, attach to minimap, etc).

Does anyone have any ideas? Thanks in advance!

Last edited by Cilraaz : 05-31-06 at 07:07 AM.
  Reply With Quote
05-30-06, 01:53 PM   #2
chuckg
A Fallenroot Satyr
 
chuckg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 26
If you're writing the right click menu for FuBar, why not use the included library to handle it? I hope this is good example code:

Code:
-- The top of your file, some definitions
local dewdrop = DewdropLib:GetInstance('1.0')


function EmoteFu:MenuSettings(level, value)
	-- Level is defined automatically, I believe, by FuBar so you just need to check it in your if/else

	if ( level == 1 ) then
		for key, value in EL_Types do
			dewdrop:AddLine(
				'text', value,
				'hasArrow', true,
				'value', key,
			)
		end
	elseif ( level == 2 ) then
		<code, check the "value" to match the value of the arrow which brought us here>
	end
end
You can find the whole API in the DewDrop download:
http://www.wowinterface.com/download...fo.php?id=4891

Last edited by chuckg : 05-30-06 at 01:57 PM.
  Reply With Quote
05-31-06, 07:07 AM   #3
Cilraaz
An Aku'mai Servant
 
Cilraaz's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 36
Well, I've almost got it working. I'm really excited about its progress, since it's a mod others have expressed an interest in seeing ported and it's my first.

I am getting hung up at one point though. I've been able to get the menus to display correctly now. The menu and the sub-menu are working perfectly. The issue I'm having is getting the mod to pass a slash command through an editbox. I understand that for an editbox to work, an xml file is needed, but I'm not quite sure what the programming of that xml file should even come close to looking like.

The function I have receiving the slash command follows:

Code:
function EmoteFu:PassSlashCmd(c)
	local cmd = c;
	if (not cmd) then cmd = "/"..k2; end
	dewdrop:Close(1)
	EmoteFuEditBox:SetText(cmd);
	ChatEdit_SendText(EmoteFuEditBox);
end
I have verified that the variables are being passed correctly by doing a "print(cmd)", so the variable is being passed correctly. I just need it to pass to an editbox. If anyone could lend a hand with the xml for this one (or even just point me in the right direction), I'd be very thankful...and the mod would be done!


[edit: I threw together a quick xml file based on some things I've seen in other mods, but I know it's not accurate, since I'm getting an "attempt to index global 'EmoteFuEditBox' (a nil value)" error. The code for my xml currently is:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">

	<EditBox name="EmoteFuEditBox" inherits="ChatFrameEditBoxTemplate" parent="UIParent" hidden="true">       
		<Scripts>                           
		  <OnLoad>                         
		  </OnLoad>                        
		</Scripts>                          
	</EditBox> 
	
</Ui>

Last edited by Cilraaz : 05-31-06 at 07:10 AM.
  Reply With Quote
05-31-06, 11:24 AM   #4
chuckg
A Fallenroot Satyr
 
chuckg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 26
A couple things I noticed:

1. You're close the DewDrop menu when the function is called, although I'm not sure if you're trying to close the whole menu or just the level the user is currently in. Try this for the whole menu in your definition of the level two items:
Code:
'closeWhenClicked', true
2. I don't think you need the XML file at all, there's an API call already to access the emote's in game. You should check out the following two URLs:
http://www.wowwiki.com/API_DoEmote - The function.
http://www.wowwiki.com/API_TYPE_Emotes_Token - The list of arguments.

So it seems to me that if you're iterating a loop when creating the menu, just compile a list of those emotes with the correct "tokens" (arguments) and pass it directly to the DoEmote() function.
  Reply With Quote
05-31-06, 02:59 PM   #5
Cilraaz
An Aku'mai Servant
 
Cilraaz's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 36
You are awesome! Well, it officially works now! Thanks to your help, chuckg, I'll be releasing my first mod.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » UIDropDownMenu Issue


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