changeset 5105:d058c60c98d7 draft

(svn r7176) -Fix: remove button was not always disabled when it should have been (rail/road build toolbar)
author glx <glx@openttd.org>
date Thu, 16 Nov 2006 18:41:57 +0000
parents 5ba3f928fe3c
children 8d7c32617551
files rail_gui.c road_gui.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -493,6 +493,8 @@
 
 	case WE_ABORT_PLACE_OBJ:
 		RaiseWindowButtons(w);
+		DisableWindowWidget(w, 16);
+		InvalidateWidget(w, 16);
 
 		w = FindWindowById(WC_BUILD_STATION, 0);
 		if (w != NULL) WP(w,def_d).close = true;
--- a/road_gui.c
+++ b/road_gui.c
@@ -183,12 +183,11 @@
 static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
+	case WE_CREATE: DisableWindowWidget(w, 11); break;
+
 	case WE_PAINT:
 		if (IsWindowWidgetLowered(w, 3) || IsWindowWidgetLowered(w, 4)) {
 			EnableWindowWidget(w, 11);
-		} else {
-			DisableWindowWidget(w, 11);
-			RaiseWindowWidget(w, 11);
 		}
 		DrawWindowWidgets(w);
 		break;
@@ -222,6 +221,8 @@
 
 	case WE_ABORT_PLACE_OBJ:
 		RaiseWindowButtons(w);
+		DisableWindowWidget(w, 11);
+		InvalidateWidget(w, 11);
 
 		w = FindWindowById(WC_BUS_STATION, 0);
 		if (w != NULL) WP(w,def_d).close = true;