User interface layers

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
I have a new tab on the Diplomacy Overview window, with buttons that open up fullscreen diplomacy. When a trade is made, the diplomacy overview briefly flashes on the screen, overriding the fullscreen diplomacy window for a few frames. How can I prevent this flash?

I suspect I did something wrong with the show/hide handler, or the ondisplay function, but I don't know where to look or what to look for.
 
Sounds very much like something I just did!

My bug was

instance.UnitActionButton:RegisterCallback( Mouse.eRClick, OnUpgradeTreeButton() );

ie calling the display function as opposed to just passing the function in the RegisterCallback method
 
Hmm... so perhaps I did something wrong with the callback? Here's the steps I used to open fullscreen diplomacy from a button on the diplomacy overview window:

1. Add button to window.
2. Set callback.
3. Offer a deal.

PHP:
AddButton(
    controlTable.MainStack,
    "[ICON_PLUS]",
    Locale.ConvertTextKey("TXT_KEY_DEAL_STATUS_BORDERS_YES_TT", Game.GetDealDuration()),
	function()
		UI_DoTrade{
			fromPlayerID = Game.GetActivePlayer(), 
			toPlayerID = player:GetID(),
			agreement = "OpenBorders"
		}
	end
)
PHP:
function AddButton(control, text, tooltip, callbackFunction, width)
    local button = {}
    ContextPtr:BuildInstanceForControl("ButtonInstance", button, control)
    ...
   
    if callbackFunction then
        button.Button:RegisterCallback(Mouse.eLClick, callbackFunction)
        ...
    end
    return button
end
PHP:
 function UI_DoTrade(fromPlayerID, toPlayerID, fromGold, toGold, fromGoldRate, toGoldRate, fromResources, toResources, agreement)
     local deal = UI.GetScratchDeal()
    ...
    UI.DoEqualizeDealWithHuman()
 end
 
Back
Top Bottom