Nothing entered.
[http://sourceforge.net/p/ufoai/bugs/1951 Item 1951] imported from sourceforge.net tracker on 2013-01-28 19:14:56
I just discovered a bug has been introduced in r20079 (mattn cleaned up base menu script)
When a button is disabled in base menu, you should be able to click on it to call "check_building_status idx", where idx is the buildingID corresponding to the button you clicked. This allows to pop up a text explaining why you can't enter in this menu. (see B_CheckBuildingStatusForMenu_f() in cl_basemanagement.c)
Would you have an idea to restore this call, without re-adding the NA pictures mattn removed (we don't need them)?
===== Comments Ported from Sourceforge =====
====== nobody (2008-12-23 08:47:40) ======
I dont check the diff, but there are no way to click on a disabled node (button...) with the current code. And i dont think it's a good idea to active that. No body will click on a disabled button (player). And if we code a click event, we dont want/need to check if the node is disabled or not (dev), because a disabled node may not execute the common action.
2 ways:
* Add an explanation into the tooltip. A tooltip can be a cvar, we also can update the tooltip like that :
*foobutton tooltip "You dont have the 'Hospital' building on this base."
Setting it when it's need (in the same code disabling the button?)
* split the disabled click into a new event. If we click on a disabled node, "click { }" will not be executed, but "disabledClick { }". It need a very little patch.
====== kracken (2008-12-23 09:04:15) ======
i don't know who is nobody, but whatever ;)
I agree this isn't really good to make player click on disabled button (basically, before this was broken, I added a tooltip "click here for more info" on the button.
Now that's I've sayed that, I'd be more in favor to the first way you proposed: changing tooltip each time base menu is opened. The only problem I can think of, is that default tooltip written in script for enabled button may be erased. I guess we will have to define those tooltips in code too, no?
====== rudolfowood (2009-03-26 21:30:26) ======
bayo told me that it is easy to update a buttons tooltip via MN_GetNodeByPath->tooltip = "some new value" . This could be integrated into B_BaseInit_f. The button nodes must be loaded (they could be ref-stored in some static vars to reduce reloading them on every update), then the tooltips can be updated according to its actual state, disabled state could also be updated this way (and confuncs removed)
geever suggested not to access nodes from code directly, see discussion starting http://colabti.org/irclogger/irclogger_log/ufoai?date=2009-03-26,Thu#l226
====== rudolfowood (2009-03-28 09:17:20) ======
in rev. 23735 I implemented a basic version of updated tooltips, further work should be done to use e.g. building status texts from B_CheckBuildingStatusForMenu
====== tlh2000 (2009-11-17 19:17:59) ======
check_building_status should be called if the buttons are disabled but the user clicked them - bayo could you please have a look at this?
====== bayo-fr (2009-11-17 19:24:49) ======
If we want to click on a disabled button... do not disable it. Who will click on a disabled button?
====== tlh2000 (2010-01-07 19:25:51) ======
bayo - please have a look at this
====== tlh2000 (2010-01-07 19:28:36) ======
attached a patch that isn't 100% working yet, but once the injection into the onClick is working, the patch should do it
one thing should still be modified later - the gray buttons aren't right - as bayo said, nobody would click a deactivated button, so we should not use a gray color, but something else.
====== tlh2000 (2010-01-07 19:30:26) ======
oh - and the onclick from the node definition can be removed, too, no? (it's added later via confuncs)
====== bayo-fr (2010-01-07 23:08:45) ======
i think we should
1) create a onAction for buttons
2) update the scripts with it
3) and then add again onClick (event when we click on the node, for any status, and it should work for any nodes)
====== tlh2000 (2010-01-16 18:44:06) ======
what should onAction do?
====== tlh2000 (2010-06-19 06:38:03) ======
what's the state of this? still an issue? or wasn't the handling reworked anyway?
====== bayo-fr (2010-06-19 09:01:23) ======
Nothing change about the behaviour. I dont know if it is an issue, i think it is a feature.
====== geever (2011-01-07 22:56:24) ======
Disabled buttons have tooltip and I think it's fine so I close this bug.
-geever