Originally Posted by Aicam
Do something like the following and you will notice that the callback of the button has nothing to do with the action triggered with the keybind.
Lua Code:
ZO_OptionsWindowResetToDefaultButton:SetCallback( function() d( "Hello World" ) end )
The only option i see is to hook into ZO_Dialogs_ShowDialog( name, ... ).
I just don't think this is a really good idea unless you know all possible dialog names.
|
It's true that code I have posted before did not store original callback, so it won't work the way we want. lyravega's code does not cause issues just because he calls ReloadUI() from the callback.
So I was digging around and I found that dialog displayed from the callback is "OPTIONS_RESET_TO_DEFAULTS" and from this dialog is called function ZO_OptionsWindow_LoadDefaults(). So maybe hook this function?
Lua Code:
ZO_PreHook("ZO_OptionsWindow_LoadDefaults",
function(control)
if ZO_OptionsWindow.currentPanel == yourPanelId then
--your code
return true --true means that ZO_PreHook will not call original function
end
return false
end)