aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_tv_table.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-11-30 16:31:45 +0100
committerDan Gudmundsson <[email protected]>2011-12-02 17:07:24 +0100
commit6bbe0512b1686f06489893479ae1d14ef15d004a (patch)
tree009e16f0debb9dd2aa8532a3daa5e9705df2c343 /lib/observer/src/observer_tv_table.erl
parent69445197463ee031864b70f2b5618013461b2df0 (diff)
downloadotp-6bbe0512b1686f06489893479ae1d14ef15d004a.tar.gz
otp-6bbe0512b1686f06489893479ae1d14ef15d004a.tar.bz2
otp-6bbe0512b1686f06489893479ae1d14ef15d004a.zip
[observer] Added an application viewer
Diffstat (limited to 'lib/observer/src/observer_tv_table.erl')
-rw-r--r--lib/observer/src/observer_tv_table.erl31
1 files changed, 4 insertions, 27 deletions
diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl
index dea3526a8b..dd11ba5470 100644
--- a/lib/observer/src/observer_tv_table.erl
+++ b/lib/observer/src/observer_tv_table.erl
@@ -221,33 +221,10 @@ search_area(Parent) ->
edit(Index, #state{pid=Pid, frame=Frame}) ->
Str = get_row(Pid, Index, all),
- Dialog = wxTextEntryDialog:new(Frame, "Edit object:", [{value, Str}]),
- case wxTextEntryDialog:showModal(Dialog) of
- ?wxID_OK ->
- New = wxTextEntryDialog:getValue(Dialog),
- wxTextEntryDialog:destroy(Dialog),
- case Str =:= New of
- true -> ok;
- false ->
- complete_edit(Index, New, Pid)
- end;
- ?wxID_CANCEL ->
- wxTextEntryDialog:destroy(Dialog)
- end.
-
-complete_edit(Row, New0, Pid) ->
- New = case lists:reverse(New0) of
- [$.|_] -> New0;
- _ -> New0 ++ "."
- end,
- try
- {ok, Tokens, _} = erl_scan:string(New),
- {ok, Term} = erl_parse:parse_term(Tokens),
- Pid ! {edit, Row, Term}
- catch _:{badmatch, {error, {_, _, Err}}} ->
- self() ! {error, ["Parse error: ", Err]};
- _Err ->
- self() ! {error, ["Syntax error in: ", New]}
+ case observer_lib:user_term(Frame, "Edit object:", Str) of
+ cancel -> ok;
+ {ok, Term} -> Pid ! {edit, Index, Term};
+ Err = {error, _} -> self() ! Err
end.
handle_event(#wx{id=?ID_REFRESH},State = #state{pid=Pid}) ->