zapat 56 Posted September 3, 2013 THE BACKGROUND: I have a pretty complex menu, with lots of dynamic content and buttons. in my menu.hpp I set PLGRMUI_menuDisplay variable to remember the menuId by onLoad = "uiNamespace setVariable ['PLGRMUI_menuDisplay', _this select 0];"; So I can manipulate the UI when being opened. After creating the menu by createDialog, I set dynamic content by referring to eg. PLGRMUI_menuDisplay displayCtrl 1003; with uiNamespace do with uiNamespace do { (PLGRMUI_menuDisplay displayCtrl 1003) ctrlSetTooltip "blahblah"; //looots of similiar settings }; THE PROBLEM: every once in a while, when opening the menu I get error: undefined variable PLGRMUI_menuDisplay. in everchanging lines of the sqf which sets the dynamic content. NOT content related. PLGRMUI_menuDisplay should stay until next opening of the menu, shouldn't it? It seems that if creating the menu takes more than x time, PLGRMUI_menuDisplay becomes nil. Every help is much appreciated. Share this post Link to post Share on other sites
jts_2009 96 Posted September 3, 2013 not sure how you use your code, but what about: private "_var"; _var = (uiNamespace getVariable "PLGRMUI_menuDisplay"); with uiNamespace do { (_var displayCtrl 1003) ctrlSetTooltip "blahblah"; //looots of similiar settings }; Share this post Link to post Share on other sites
zapat 56 Posted September 3, 2013 Thanks JTS, It is working with disableserialization and using local _var! Anyhow, UInamespace variables seem to disappear after a while. Share this post Link to post Share on other sites
jts_2009 96 Posted September 3, 2013 Anyhow, UInamespace variables seem to disappear after a while. hm. Don't know anything about it. I don't had problems with that, playing 2 hours :D Share this post Link to post Share on other sites
Worldeater 2 Posted September 3, 2013 This might be a race condition. If so, then simply waiting for the variable to exist should fix it: with uiNamespace do { waitUntil not isNil { PLGRMUI_menuDisplay }; (PLGRMUI_menuDisplay displayCtrl 1003) ctrlSetTooltip "blahblah"; //looots of similiar settings }; Share this post Link to post Share on other sites
das attorney 858 Posted January 24, 2014 Just stumbled on this thread last night while working on a dialog - the last post works perfectly. There is an error in the syntax though so if it helps anyone else, then try: with uiNamespace do { waitUntil {not isNil {PLGRMUI_menuDisplay}}; (PLGRMUI_menuDisplay displayCtrl 1003) ctrlSetTooltip "blahblah"; //looots of similiar settings }; Share this post Link to post Share on other sites