aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/examples/demo/demo.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-12-14 14:45:50 +0100
committerDan Gudmundsson <[email protected]>2013-01-09 11:44:28 +0100
commitae412569d12eff642b5eaaf55915ea8cda9dce0b (patch)
tree1149a2e00d8ed78910a4582029eb862cd84ab297 /lib/wx/examples/demo/demo.erl
parenta15d14a0c266b9e86c5a2ca39b3c1808a5e1bae0 (diff)
downloadotp-ae412569d12eff642b5eaaf55915ea8cda9dce0b.tar.gz
otp-ae412569d12eff642b5eaaf55915ea8cda9dce0b.tar.bz2
otp-ae412569d12eff642b5eaaf55915ea8cda9dce0b.zip
wx: Fix the demo
Changing demo, didn't close the previous choosen demo, which looked really bad on Windows.
Diffstat (limited to 'lib/wx/examples/demo/demo.erl')
-rw-r--r--lib/wx/examples/demo/demo.erl10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/wx/examples/demo/demo.erl b/lib/wx/examples/demo/demo.erl
index b0802a5c32..76ebc804bb 100644
--- a/lib/wx/examples/demo/demo.erl
+++ b/lib/wx/examples/demo/demo.erl
@@ -204,7 +204,7 @@ handle_event(#wx{event=#wxCommand{type=command_listbox_selected, cmdString=Ex}},
{noreply, State};
_ ->
wxSizer:detach(DemoSz, Example),
- exit(wx_object:get_pid(Example), shutdown),
+ wx_object:call(Example, shutdown),
unload_code(Code),
NewExample = load_example(Ex, State),
wxSizer:add(DemoSz, NewExample, [{proportion,1}, {flag, ?wxEXPAND}]),
@@ -252,8 +252,7 @@ handle_event(#wx{id = Id,
{caption, "About"}])),
{noreply, State};
?wxID_EXIT ->
- exit(wx_object:get_pid(State#state.example), shutdown),
- timer:sleep(100), %% Give the example process some time to cleanup.
+ wx_object:call(State#state.example, shutdown),
{stop, normal, State};
_ ->
{noreply, State}
@@ -270,8 +269,7 @@ code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
terminate(_Reason, State) ->
- exit(wx_object:get_pid(State#state.example), shutdown),
- timer:sleep(100), %% Give the example process some time to cleanup.
+ catch wx_object:call(State#state.example, shutdown),
wx:destroy().
%%%%%%%%%%%%%%%%% Internals %%%%%%%%%%
@@ -279,8 +277,6 @@ terminate(_Reason, State) ->
load_example(Ex, #state{demo={DemoPanel,DemoSz}, log=EvCtrl, code=Code}) ->
ModStr = "ex_" ++ Ex,
Mod = list_to_atom(ModStr),
-%% WxDir = code:lib_dir(wx),
-%% ModFile = filename:join([WxDir, "examples","demo", ModStr ++ ".erl"]),
ModFile = ModStr ++ ".erl",
load_code(Code, file:read_file(ModFile)),
find(Code),