From bc70008112fbc8bfaf2b401f4a38bc11ac02c9f6 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 22 Nov 2012 15:51:58 +0100 Subject: debugger: Fix 2.9 compat wxTextCtrl:setFocus selects all input. wxListBox:insertItems() Asserts for a zero list, sigh.. --- lib/debugger/src/dbg_wx_filedialog_win.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/debugger') diff --git a/lib/debugger/src/dbg_wx_filedialog_win.erl b/lib/debugger/src/dbg_wx_filedialog_win.erl index f109652a70..c8ecb7b5d4 100644 --- a/lib/debugger/src/dbg_wx_filedialog_win.erl +++ b/lib/debugger/src/dbg_wx_filedialog_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -381,7 +381,6 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com Last = wxTextCtrl:getLastPosition(TC), wxTextCtrl:setSelection(TC, Start, Last), destroy_completion(Comp), - wxWindow:setFocus(TC), State#state{ptext=Path, completion=undefined}; Paths when Comp =:= undefined -> {PosX,PosY} = wxListCtrl:getPosition(LC), @@ -406,14 +405,16 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com %% wxListBox:connect(LB, command_listbox_doubleclicked), wxListBox:connect(LB, command_listbox_selected), wxWindow:show(Temp), + %% setFocus does a select all on 2.9 sigh.. + {Start, Last} = wxTextCtrl:getSelection(TC), wxWindow:setFocus(TC), + wxTextCtrl:setSelection(TC, Start, Last), State#state{completion = {Temp, LB}, ptext=Wanted}; Paths -> {_Temp, LB} = Comp, wxListBox:clear(LB), Files = [filename:basename(File) || File <- Paths], - wxListBox:insertItems(LB,Files,0), - wxWindow:setFocus(TC), + Files /= [] andalso wxListBox:insertItems(LB,Files,0), State#state{ptext=Wanted} end. -- cgit v1.2.3