Thread Tools Display Modes
02-13-07, 05:11 AM   #1
adflicto
A Murloc Raider
Join Date: Feb 2007
Posts: 7
Detecting click on a quest event

How do i register the event, i assume is fired, when the user clicks a quest in the quest log? Cant find any event like that.
I need to open a frame when the user clicks a quest.
  Reply With Quote
02-13-07, 01:35 PM   #2
mulesh
A Chromatic Dragonspawn
 
mulesh's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 193
I think that sort of thing is handled in the xml file for the frame with <OnClick>
Example:
Code:
<Frame name="MyFrame" enableMouse="true">
--All your Sizes and Layers stuff--
<Scripts>
<OnLoad>this:RegisterForClicks("LeftButtonDown", "RightButtonDown");</OnLoad>
<OnClick>function_to_call(arg1)</OnClick> --arg1 is the button used to click with
</Scripts>
</Frame>
I know this will work for buttons and such (used it myself), but I have no idea what goes on in the quest frame. Anyway, hope this helps get you going
  Reply With Quote
02-15-07, 12:55 PM   #3
adflicto
A Murloc Raider
Join Date: Feb 2007
Posts: 7
Yes i would do that as well, but my problem is that i want to register the event externally, that is not in the same XML file as the QuestFrame.xml (or whatever its called).

So the question should rather be: How do i register an external event, such as a mouseclick on a button in another frame? Or if this can't be done, how do i make it work?
  Reply With Quote
02-15-07, 06:28 PM   #4
mulesh
A Chromatic Dragonspawn
 
mulesh's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 193
You can define script handlers in the lua file using SetScript().

You will need to know the name of the frame you want to modify. You can use this macro to find the name if you cant locate its name in the files:
Code:
/script DEFAULT_CHAT_FRAME:AddMessage(GetMouseFocus():GetName())
Using the example above, your lua code would look something like this:
Code:
MyFrame:SetScript("OnLoad", this:RegisterForClicks("LeftButtonDown", "RightButtonDown"));
MyFrame:SetScript("OnClick", function_to_call(arg1));
I think the QuestFrame you are looking at already picks up on clicking so you probably wont need the "OnLoad" bit. But if you want stuff to happen when clicking happens then you need to hook the "OnClick" script handler.

Question. Are you wanting to supress the normal action that happens when clicking on a quest in the questlog frame?
  Reply With Quote
02-16-07, 06:23 AM   #5
adflicto
A Murloc Raider
Join Date: Feb 2007
Posts: 7
1. Thx, that was kind of what i was looking for, haven't tried it yet though.

2. Answer to your question: No, i don't want to supress the standard actions, i just need a frame to Show() when the user clicks a quest.
  Reply With Quote
02-16-07, 07:09 AM   #6
adflicto
A Murloc Raider
Join Date: Feb 2007
Posts: 7
okay, the frame is called QuestLogFrame, and the buttons for which im trying (ain't doing that well ) to get events from is called QuestLogTitle1,...,6. These buttons inherit from the base button called QuestLogTitleButtonTemplate in which all the stuff happens.

i got this, but it doesn't work (QuestNoteFrame is the frame i wish to Show()):

Code:
function QuestNoteFrame_OnLoad()
	QuestNoteFrame:Hide();
	QuestLogTitle1:SetScript("OnClick",	QuestNoteFrame:Show());
end
I get an error that says to correct my usage of the function SetScript, in the above line. And the QuestNoteFrame isn't hidden.
  Reply With Quote
02-16-07, 07:18 AM   #7
adflicto
A Murloc Raider
Join Date: Feb 2007
Posts: 7
okay got it, my usage WAS wrong

it should be

Code:
QuestLogTitle1:SetScript("OnClick", function() QuestNoteFrame:Show() end);
and not

Code:
QuestLogTitle1:SetScript("OnClick", QuestNoteFrame:Show());
  Reply With Quote
02-16-07, 05:37 PM   #8
mulesh
A Chromatic Dragonspawn
 
mulesh's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 193
/hi5

sweet
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Detecting click on a quest event


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