From 844afaf366ad7a4f668a60e896d0ae3b9e5d850b Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 19 Mar 2012 15:54:30 +0100 Subject: [reltool] Fix GUI problems on Windows The new warning list did not work on Windows. It could not display tooltips for each warning and the popup window would always disappear behind the main system window. Also, column width did not occur well initially in list controls. --- lib/reltool/src/reltool_utils.erl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/reltool/src/reltool_utils.erl') diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl index 3e50324011..b0def45213 100644 --- a/lib/reltool/src/reltool_utils.erl +++ b/lib/reltool/src/reltool_utils.erl @@ -29,6 +29,7 @@ app_dir_test/2, split_app_dir/1, get_item/1, get_items/1, get_selected_items/3, select_items/3, select_item/2, + get_column_width/1, safe_keysearch/5, print/4, add_warning/3, @@ -383,6 +384,26 @@ select_item(ListCtrl, [{ItemNo, Text} | Items]) -> select_item(_ListCtrl, []) -> ok. +get_column_width(ListCtrl) -> + wx:batch(fun() -> + {Total, _} = wxWindow:getClientSize(ListCtrl), + Total - scroll_size(ListCtrl) + end). + +scroll_size(ObjRef) -> + case os:type() of + {win32, nt} -> 0; + {unix, darwin} -> + %% I can't figure out is there is a visible scrollbar + %% Always make room for it + wxSystemSettings:getMetric(?wxSYS_VSCROLL_X); + _ -> + case wxWindow:hasScrollbar(ObjRef, ?wxVERTICAL) of + true -> wxSystemSettings:getMetric(?wxSYS_VSCROLL_X); + false -> 0 + end + end. + safe_keysearch(Key, Pos, List, Mod, Line) -> case lists:keysearch(Key, Pos, List) of false -> -- cgit v1.2.3